前端大更新vuex

This commit is contained in:
橙子
2021-10-17 18:37:07 +08:00
parent b77b91912b
commit 6bb2b41840
24 changed files with 332 additions and 65 deletions

19
Yi.Vue/src/permission.js Normal file
View File

@@ -0,0 +1,19 @@
import router from './router/index'
import store from './store/index'
// import accountApi from '@/api/accountApi'
router.beforeEach((to, from, next) => {
const user = store.state.user.user; //获取是有user
console.log(user)
if (!user) { //如果没有登入
if (to.path == '/login/' || to.path == '/register/' || to.path == '/reset_password/' || to.path == '/qq/') {
next();
} else {
next({ path: '/login/' });
}
} else {
next();
}
})