Skip to content

Commit

Permalink
fix: judge question mark
Browse files Browse the repository at this point in the history
  • Loading branch information
baozouai committed Jul 23, 2023
1 parent 2af7ad8 commit d90bdc7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/history.ts
Expand Up @@ -84,9 +84,11 @@ export class History {
}
const isBlock = await this.canJump(params)
if (urlParams) {
if (!option.url.includes('?'))
option.url += '?'
option.url += `${URL_PARAMS_KEY}=${encodeURIComponent(JSON.stringify(urlParams))}`
const urlEncodeStr = `${URL_PARAMS_KEY}=${encodeURIComponent(JSON.stringify(urlParams))}`
const includeQuestionMark = option.url.includes('?')
const preChar = includeQuestionMark ? '&' : '?'

option.url += `${preChar}&${urlEncodeStr}`
}
if (!isBlock) {
this.notifyListeners(params)
Expand Down

0 comments on commit d90bdc7

Please sign in to comment.