鍍金池/ 問答/HTML/ Vue router.beforeEach中的next({path: '/lis

Vue router.beforeEach中的next({path: '/list'}) 不跳轉(zhuǎn)

vueRouter.beforeEach(function(to, from, next) {
let s = 1; // 1 代表存有登陸狀態(tài) 0 代表沒有登陸狀態(tài)
if (0) {

next();

} else {

console.log(to);
if (to.name == "login") {
  console.log("導(dǎo)航守衛(wèi)");
  next("/list");
}

}
});

});

clipboard.png

不跳到list

回答
編輯回答
尤禮

clipboard.png
搞定了

2018年9月18日 01:29