mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(cli): iframe route sync failed
This commit is contained in:
parent
1215786c13
commit
3ee2200bea
@ -1,4 +1,4 @@
|
|||||||
import { nextTick } from 'vue';
|
import { watch, nextTick } from 'vue';
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||||
import DemoHome from './components/DemoHome';
|
import DemoHome from './components/DemoHome';
|
||||||
import { decamelize } from '../common';
|
import { decamelize } from '../common';
|
||||||
@ -89,7 +89,7 @@ export const router = createRouter({
|
|||||||
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
|
scrollBehavior: (to, from, savedPosition) => savedPosition || { x: 0, y: 0 },
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach(() => {
|
watch(router.currentRoute, () => {
|
||||||
if (!router.currentRoute.value.redirectedFrom) {
|
if (!router.currentRoute.value.redirectedFrom) {
|
||||||
nextTick(window.syncPath);
|
nextTick(window.syncPath);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user