提交 928cb187 编写于 作者: Q qiang

fix(h5): check location.pathname out of router.base

上级 57812d5c
......@@ -46,10 +46,17 @@ function getHash () {
function getLocation (base = '/') {
let path = decodeURI(window.location.pathname)
const search = window.location.search
const hash = window.location.hash
// 检查和纠正 path
if (base[base.length - 1] === '/' && path === base.substring(0, base.length - 1)) {
path = base
window.history.replaceState({}, '', base + search + hash)
}
if (base && path.indexOf(base) === 0) {
path = path.slice(base.length)
}
return (path || '/') + window.location.search + window.location.hash
return (path || '/') + search + hash
}
/**
......@@ -207,4 +214,4 @@ export default {
Vue.use(VueRouter)
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册