You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-pc/plugins/router.js

11 lines
274 B

export default ({ app }) => {
app.router.beforeEach((to, from, next) => {
// 获取用户信息
const { token, userInfo } = app.store.state;
if (token && Object.keys(userInfo).length === 0) {
app.store.dispatch("getUserInfo");
}
next();
});
};