We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果在context.create({}),这里的选项,没有办法进行后继的一些处理,比如基于某些原因,项目中途使用此组件或者基于标准写法定义选项,后续是没有办法进行转换的。
dataContext.create({ getInitData: { method: "GET", url: "invoice/getInitData", cache: "default" })
比如 cache: "default" 是按fetch标准写法,要转换成你的storage,是无法实现的。
我加了一个事件,可以处理了,还有根据method == "POST"就可以全局作一些处理,这都是很常见的作法, context.on("processOptions", function (config) { if (config.method == "POST") { config.header = Object.assign({}, config.header, { "Content-Type": "text/json" }); }
if (config.cache === "default") { config.storage = { type: 'localStorage', key: config.url, tag: 'v1.0' }; }
});
还有一个问题,目前导致我不能继续使用这个组件了,
在sendAjax 中POST方法下处理主体数据,你在内部序列化时进行了 params 化,但是并不是所有数据都是这种处理方法,外部无法进行处理。比如,我项目的提交数据格式必须是json。像zepto,jquery都有这方法的机制,用processData标记是否需要内部进行处理。
The text was updated successfully, but these errors were encountered:
第一个问题:
请求在发送之前会调用willFetch回调,接收两个参数vars和config,vars是每次请求的动态数据,config是内部process后的options的结果。可以通过在这个回调里修改config。
willFetch
vars
config
process
options
第二个问题:
你指出的应该是参数命名问题,你建议使用cache,是这样理解吗?
cache
第三个问题:
好问题!希望传JSON字符串,你希望具体怎么写?我看看能不能提供支持。
Sorry, something went wrong.
碰到同样的问题,什么时候可以提供直接传递json的功能?不然只能回到zepto了
No branches or pull requests
如果在context.create({}),这里的选项,没有办法进行后继的一些处理,比如基于某些原因,项目中途使用此组件或者基于标准写法定义选项,后续是没有办法进行转换的。
dataContext.create({
getInitData: {
method: "GET",
url: "invoice/getInitData",
cache: "default"
})
比如 cache: "default" 是按fetch标准写法,要转换成你的storage,是无法实现的。
我加了一个事件,可以处理了,还有根据method == "POST"就可以全局作一些处理,这都是很常见的作法,
context.on("processOptions", function (config) {
if (config.method == "POST") {
config.header = Object.assign({}, config.header, { "Content-Type": "text/json" });
}
});
还有一个问题,目前导致我不能继续使用这个组件了,
在sendAjax 中POST方法下处理主体数据,你在内部序列化时进行了 params 化,但是并不是所有数据都是这种处理方法,外部无法进行处理。比如,我项目的提交数据格式必须是json。像zepto,jquery都有这方法的机制,用processData标记是否需要内部进行处理。
The text was updated successfully, but these errors were encountered: