vue 当前路由重复点击跳转报错
生活随笔
收集整理的這篇文章主要介紹了
vue 当前路由重复点击跳转报错
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
當(dāng)菜單路由重復(fù)點(diǎn)擊時(shí),會(huì)出現(xiàn)以下報(bào)錯(cuò):
雖然沒(méi)有什么影響(不知道深層有什么影響,頁(yè)面運(yùn)行反正沒(méi)啥問(wèn)題),但是有個(gè)報(bào)錯(cuò)看著就畢竟鬧心。
有以下解決方案:
刷新頁(yè)面
路由
{path: "/refresh",name: "refresh",hideInMenu: true,component: () =>import( /* webpackChunkName: "login" */ "@/components/refresh/refresh"), },菜單跳轉(zhuǎn)時(shí)
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 });}},如果當(dāng)前路由與跳轉(zhuǎn)路由相同,則跳轉(zhuǎn)到refresh頁(yè)面中,再跳回原頁(yè)面,重新加載一次當(dāng)前路由。
總結(jié)
以上是生活随笔為你收集整理的vue 当前路由重复点击跳转报错的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Mysql命令行导出远程mysql数据库
- 下一篇: 5G学习笔记:NSA和SA