【发布时间】:2021-08-20 07:25:35
【问题描述】:
我使用此代码进行重定向
beforeCreate() {
if (this.$store.state.user.user.id != null) {
this.$router.push('/')
}
}
我的 this.$store.state.user.user.id 在中间件中用这个代码赋值。
import {GET_CARD, GET_USER} from "../store/types/action-types";
export default async function ({store}) {
await store.dispatch('cart/' + GET_CARD)
await store.dispatch('user/user/' + GET_USER)
}
如果用户登录显示页面 0.5 秒和下一个重定向。我不需要显示登录页面和下一个重定向。 tnx。
【问题讨论】:
标签: nuxt.js