This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复request.jsonp数据不发送的bug;修复router组件刷新时URL的search部分丢失的bug

old
宇天 2018-06-28 22:31:47 +08:00
parent 207dff5c17
commit 775e5d6f66
2 changed files with 3 additions and 2 deletions

View File

@ -33,7 +33,7 @@ try {
let originAnchor = doc.createElement('a')
originAnchor.href = location.href
const noBodyMethods = ['GET', 'HEAD']
const noBodyMethods = ['GET', 'HEAD', 'JSONP']
const error = {
10001: 'argument url is required',
10002: 'method "set" required an object or 2 args',

View File

@ -202,8 +202,9 @@ class Router {
this.path = path
} else {
let hash = forceCleanHash ? '' : location.hash
let search = forceCleanHash ? '' : location.search
path = path.replace(/^[/]+?/, '')
window.history.pushState({ path }, null, `/${path + hash}`)
window.history.pushState({ path }, null, `/${path + search + hash}`)
this.path = path
// pushState不会触发popstate事件,所以要手动触发路由检测
this.__check__()