Unverified Commit 1e19e9df authored by Jay丶千珏's avatar Jay丶千珏 Committed by GitHub

fix(route.js):修复因为深度合并对象引起某些情况下不能跳转的问题 (#1267)

parent ec54e0e6
...@@ -28,7 +28,7 @@ class Router { ...@@ -28,7 +28,7 @@ class Router {
// 整合路由参数 // 整合路由参数
mixinParam(url, params) { mixinParam(url, params) {
url = url && this.addRootPath(url) url = url && this.addRootPath(url)
// 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary" // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
// 如果有url中有get参数,转换后无需带上"?" // 如果有url中有get参数,转换后无需带上"?"
let query = '' let query = ''
...@@ -54,12 +54,12 @@ class Router { ...@@ -54,12 +54,12 @@ class Router {
mergeConfig.url = this.mixinParam(options, params) mergeConfig.url = this.mixinParam(options, params)
mergeConfig.type = 'navigateTo' mergeConfig.type = 'navigateTo'
} else { } else {
mergeConfig = uni.$u.deepMerge(options, this.config) mergeConfig = uni.$u.deepMerge(this.config, options)
// 否则正常使用mergeConfig中的url和params进行拼接 // 否则正常使用mergeConfig中的url和params进行拼接
mergeConfig.url = this.mixinParam(options.url, options.params) mergeConfig.url = this.mixinParam(options.url, options.params)
} }
if(params.intercept) { if (params.intercept) {
this.config.intercept = params.intercept this.config.intercept = params.intercept
} }
// params参数也带给拦截器 // params参数也带给拦截器
...@@ -119,4 +119,4 @@ class Router { ...@@ -119,4 +119,4 @@ class Router {
} }
} }
export default (new Router()).route export default (new Router()).route
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment