Skip to content

Commit

Permalink
fix(taro-quickapp): 修复路由传参的问题,close #3620
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Jul 2, 2019
1 parent dad3ae4 commit c0c5cb2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/taro-quickapp/src/api/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,15 @@ function qappNavigate (options = {}, method = 'push') {
}

function getUrlParams (url = '') {
let params = {}
url && url.replace(/(\w+)=(\w+)/ig, function (a, b, c) {
params[b] = unescape(c)
const params = {}
url = url.replace(/#.*$/, '')
const queryArray = url.split(/[?&]/).slice(1)
queryArray.forEach(item => {
const match = item.match(/([^=]+)=([^=]+)/)
if (match != null) {
params[match[1]] = decodeURIComponent(match[2])
}
})

return params
}

Expand Down

0 comments on commit c0c5cb2

Please sign in to comment.