解决vue element导航重复点击路由报错
生活随笔
收集整理的這篇文章主要介紹了
解决vue element导航重复点击路由报错
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
報錯:重復點擊左側導航欄的首頁,出現報錯
解決方法:以下的兩種一樣,只是文件類型不一樣
1.js寫法
import Router from ‘vue-router’ Vue.use(Router) const originalPush = Router.prototype.pushRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }2.ts寫法
import Router from ‘vue-router’ Vue.use(Router) const originalPush = Router.prototype.push Router.prototype.push = function push(location:string) {return (originalPush.call(this, location) as any).catch((err:any) => err) }總結
以上是生活随笔為你收集整理的解决vue element导航重复点击路由报错的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tp6框架结合阿里短信接口发送短信并记录
- 下一篇: vue 解决路由重复点击报错