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
1.8.7
太简单,无需重现链接
备注一下,文件是:uview-ui/libs/function/route.js
// 对外的方法名称 async route(options = {}, params = {}) { // 合并用户的配置和内部的默认配置 let mergeConfig = {} if (typeof options === 'string') { // 如果options为字符串,则为route(url, params)的形式 mergeConfig.url = this.mixinParam(options, params) mergeConfig.type = 'navigateTo' } else { // 仔细看这句,this.config中的类型始终是 navigateTo,那么无论我 options 中传什么类型,都会被这个 this.config 覆盖 // 这里应该是 先将 this.config 复制一份,然后将 options的选项往这个 新复制的 this.config 中合并 mergeConfig = uni.$u.deepMerge(options, this.config) // 否则正常使用mergeConfig中的url和params进行拼接 mergeConfig.url = this.mixinParam(options.url, options.params) } // ... 省略代码 }
可以使用:uni.$u.deepMerge(deepClone(this.config), options)
正常跳转非navigateTo类型路由
只进行navigateTo路由跳转,其他均失效
// 对外的方法名称 async route(options = {}, params = {}) { // 合并用户的配置和内部的默认配置 let mergeConfig = {} if (typeof options === 'string') { // 如果options为字符串,则为route(url, params)的形式 mergeConfig.url = this.mixinParam(options, params) mergeConfig.type = 'navigateTo' } else { mergeConfig = options // 否则正常使用mergeConfig中的url和params进行拼接 mergeConfig.url = this.mixinParam(options.url, options.params) } const baseConfig = uni.$u.deepClone(this.config) if(params.intercept) { baseConfig.intercept = params.intercept } // params参数也带给拦截器 mergeConfig.params = params // 合并内外部参数 mergeConfig = uni.$u.deepMerge(baseConfig, mergeConfig) // 判断用户是否定义了拦截器 if (typeof uni.$u.routeIntercept === 'function') { // 定一个promise,根据用户执行resolve(true)或者resolve(false)来决定是否进行路由跳转 const isNext = await new Promise((resolve, reject) => { uni.$u.routeIntercept(mergeConfig, resolve) }) // 如果isNext为true,则执行路由跳转 isNext && this.openPage(mergeConfig) } else { this.openPage(mergeConfig) } }
The text was updated successfully, but these errors were encountered:
我今天也遇到这个问题了,永远都是type不管怎么设置都是navigateTo; 我看了一下,1.8.7的commit,其中有一个是“fix(route.js):调用方法错误”
他把原本的deepClone改成了deepMerge,导致type永远都是this.config中的type(navigateTo); 只要改回去就好了
Sorry, something went wrong.
No branches or pull requests
版本
1.8.7
转载链接
太简单,无需重现链接
重现步骤
备注一下,文件是:uview-ui/libs/function/route.js
可以使用:uni.$u.deepMerge(deepClone(this.config), options)
期望的结果是什么?
正常跳转非navigateTo类型路由
实际的结果是什么?
只进行navigateTo路由跳转,其他均失效
我修改后的代码
The text was updated successfully, but these errors were encountered: