用户登录后,我想将他们带到 vue sfc 的用户个人资料页面,但是在我更改路线后,即使它确实将我带到了个人资料页面,但直到我刷新后才加载这一页。 这是我在登录后更改路由的一段登录组件代码,
pendingHook() {
let pw = this.PendingWorkshop();
if (pw) {
localStorage.removeItem("pendingWorkshop");
this.TimerAlert(
"Please wait...",
"We are registering you for the workshop!",
500
);
// this.GotoWS(pw);
this.joinWorkshop(pw);
} else {
let pi = this.GetPendingInvoice()
if (pi) {
this.RemovePendingInvoice()
this.$router.push({name: "invoice"})
} else {
this.Goto({ name: "user_profile" });
}
}
}
它带我进入用户配置文件,它也是一个 vue sfc,它从服务器获取数据并显示它。但我只在路由更改后刷新时看到页面。 我猜测路线更改发生在数据加载之前,但我不确定如何解释这一点。