没有指定新 hash 时保留原有 hash

This commit is contained in:
liaoxuezhi 2019-12-12 23:58:02 +08:00
parent 85fd7e2433
commit 73a67cd4e7
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,7 @@ export default function(schema) {
? to.substring(0, idx2)
: to;
let search = ~idx ? to.substring(idx, ~idx2 ? idx2 : undefined) : '';
let hash = ~idx2 ? to.substring(idx2) : '';
let hash = ~idx2 ? to.substring(idx2) : location.hash;
if (!pathname) {
pathname = location.pathname;
@ -77,6 +77,7 @@ export default function(schema) {
};
this.env = {
updateLocation: (location, replace) => {
debugger;
router[replace ? 'replace' : 'push'](normalizeLink(location));
},
isCurrentUrl: to => {