Avoided redundant navigation to current location


問題

在做菜單跳轉功能時,發現如果多次點擊同一個項,發生重復跳轉就會報錯。

Avoided redundant navigation to current location...

解決

(1) 高版本 VueRouter 新加的報錯信息,第一種辦法是減低 VueRouter 的版本。

(2) 第二種辦法是:在router文件夾下的index.js中添加以下代碼:

const originalPush = VueRouter.prototype.push

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM