vue 当前路由重复点击跳转报错
生活随笔
收集整理的這篇文章主要介紹了
vue 当前路由重复点击跳转报错
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
當菜單路由重復點擊時,會出現(xiàn)以下報錯:
雖然沒有什么影響(不知道深層有什么影響,頁面運行反正沒啥問題),但是有個報錯看著就畢竟鬧心。
有以下解決方案:
刷新頁面
路由
{path: "/refresh",name: "refresh",hideInMenu: true,component: () =>import( /* webpackChunkName: "login" */ "@/components/refresh/refresh"), },菜單跳轉(zhuǎn)時
routeJump(item) {const toPath = item.path;const thePath = this.$route.path;if (toPath == thePath) {this.$router.replace({ path: '/refresh' });} else {this.$router.push({ name: item.name });}},如果當前路由與跳轉(zhuǎn)路由相同,則跳轉(zhuǎn)到refresh頁面中,再跳回原頁面,重新加載一次當前路由。
總結(jié)
以上是生活随笔為你收集整理的vue 当前路由重复点击跳转报错的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mysql命令行导出远程mysql数据库
- 下一篇: vue面试核心,双向数据绑定,数据代理,