Avoided redundant navigation to current location: “/users”

問題產生的原因:在Vue導航菜單中,重複點擊一個菜單,即重複觸發一個相同的路由,會報錯,但不影響功能

 

解決:在router的配置文件中加入如下程式碼:


const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}

 

Tags: