|
|
@@ -46,4 +46,21 @@ const routes = [{
|
|
|
const router = new VueRouter({
|
|
|
routes
|
|
|
})
|
|
|
+router.beforeEach((to, from, next) => {
|
|
|
+ // 清除之前的定时器
|
|
|
+ if (router.timer) {
|
|
|
+ clearTimeout(router.timer);
|
|
|
+ }
|
|
|
+ // 设置新的定时器,例如每60秒切换到下一个页面
|
|
|
+ router.timer = setTimeout(() => {
|
|
|
+ if (to.path === '/shop') {
|
|
|
+ next('/lab');
|
|
|
+ } else if(to.path === '/lab') {
|
|
|
+ next('/shopmonth');
|
|
|
+ }else {
|
|
|
+ next('/shop');
|
|
|
+ }
|
|
|
+ }, 60000);
|
|
|
+ next();
|
|
|
+});
|
|
|
export default router
|