Commit 68f9266e by yancanhua

fix: 登录防抖

1 parent 50365685
......@@ -29,16 +29,22 @@ function createRouter () {
routes
})
}
var isLoginTimer = null;
router.beforeEach((to, from, next) => {
/* 路由发生变化修改页面title */
store.dispatch('setPageMeta', to.meta)
/* 路由发生变化修改页面背景色 */
document.documentElement.style.backgroundColor = to.meta.backgroundColor || '#fff'
to.matched.forEach(recode => {
console.log(recode)
setTimeout(() => {
store.dispatch('login')
}, 666)
//设置防抖,避免重复登录
if (!isLoginTimer) {
isLoginTimer = 1
setTimeout(() => {
store.dispatch('login')
isLoginTimer = null
}, 1200);
}
})
if (to.matched.some(recode => recode.meta.noAuth)) {
console.log('noAuth')
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!