首先,ElementUI的導(dǎo)航菜可以正常使用。現(xiàn)在我要做一個(gè)登錄判斷,要是沒有登錄的話,點(diǎn)擊導(dǎo)航中的‘安全中心’‘財(cái)務(wù)中心’,就會(huì)讓界面跳轉(zhuǎn)到登錄界面現(xiàn)在問題是跳轉(zhuǎn)不過去登錄界面代碼如下,望各位大佬解惑,或者有其它的方法嗎handleSelect(key, keyPath) { //console.log(key,keyPath)這里的key和keyPath都能正常打印出來
const token = Cookies.get("loginToken");//這是登錄token
if(key === 'safety' || key === 'financial'){//safety和financial是導(dǎo)航中的安全中心和財(cái)務(wù)中心
if (!token || token == '') { this.$router.push({path: '/login'});
console.log(this.$route.path)//這里能正常打印出‘/login’
}
}
}
ElementUI的導(dǎo)航菜未登錄更改路由
婷婷同學(xué)_
2019-03-12 19:33:14