mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix: sync iframe router
This commit is contained in:
parent
59f9b851d6
commit
2d63b9c8b5
@ -23,7 +23,7 @@ window.syncPath = function() {
|
|||||||
|
|
||||||
window.replacePath = function(path = '') {
|
window.replacePath = function(path = '') {
|
||||||
// should preserve hash for anchor
|
// should preserve hash for anchor
|
||||||
if (window.vueRouter.currentRoute.path !== path) {
|
if (window.vueRouter.currentRoute.value.path !== path) {
|
||||||
window.vueRouter.replace(path).catch(() => {});
|
window.vueRouter.replace(path).catch(() => {});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -82,13 +82,13 @@ function getRoutes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const router = createRouter({
|
export const router = createRouter({
|
||||||
mode: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
routes: getRoutes(),
|
routes: getRoutes(),
|
||||||
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
|
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
router.afterEach(() => {
|
||||||
if (!router.currentRoute.redirectedFrom) {
|
if (!router.currentRoute.value.redirectedFrom) {
|
||||||
nextTick(window.syncPath);
|
nextTick(window.syncPath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
1064
vant.config.js
1064
vant.config.js
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user