mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
fix: sync iframe router
This commit is contained in:
@@ -23,7 +23,7 @@ window.syncPath = function() {
|
||||
|
||||
window.replacePath = function(path = '') {
|
||||
// should preserve hash for anchor
|
||||
if (window.vueRouter.currentRoute.path !== path) {
|
||||
if (window.vueRouter.currentRoute.value.path !== path) {
|
||||
window.vueRouter.replace(path).catch(() => {});
|
||||
}
|
||||
};
|
||||
|
@@ -82,13 +82,13 @@ function getRoutes() {
|
||||
}
|
||||
|
||||
export const router = createRouter({
|
||||
mode: createWebHashHistory(),
|
||||
history: createWebHashHistory(),
|
||||
routes: getRoutes(),
|
||||
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
|
||||
});
|
||||
|
||||
router.afterEach(() => {
|
||||
if (!router.currentRoute.redirectedFrom) {
|
||||
if (!router.currentRoute.value.redirectedFrom) {
|
||||
nextTick(window.syncPath);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user