成功解决NavigationDuplicated: Avoided redundant navigation to current location:

02-28 阅读 0评论

这个问题的原因主要是处在当前路由,点击跳转还是到当前路由导致的。

成功解决NavigationDuplicated: Avoided redundant navigation to current location:,成功解决NavigationDuplicated: Avoided redundant navigation to current location:,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,解决方法,修改,第1张
(图片来源网络,侵删)

成功解决NavigationDuplicated: Avoided redundant navigation to current location:

解决方法如下:

方法一:在router文件夹的index.js文件下加入下面代码:

import Vue from "vue"
import VueRouter from "vue-router"
Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
    //修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
        return originalPush.call(this, location).catch(err => err)
    }
    //解决vue路由重复导航错误
    //获取原型对象上的push函数

 

 要是当前问题还没解决,可在点击重复路由跳转的地方写成这样来捕获异常:

  this.$router.push({ name: "video", query: { periodId: this.periodId} }).catch(err => err);

  this.$router.push({ name: "video", query: { periodId: this.periodId} }).catch(err => err);

方法二:要是push的方法不行,可以试试replace方法:

import Vue from 'vue'
import Router from 'vue-router' Vue.use(Router)
const originalPush = Router.prototype.replace Router.prototype.push = function replace(location) { return originalPush.call(this, location).catch(err => err) }

import Vue from 'vue'

成功解决NavigationDuplicated: Avoided redundant navigation to current location:,成功解决NavigationDuplicated: Avoided redundant navigation to current location:,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,解决方法,修改,第3张
(图片来源网络,侵删)

import Router from 'vue-router' Vue.use(Router)

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

成功解决NavigationDuplicated: Avoided redundant navigation to current location:,成功解决NavigationDuplicated: Avoided redundant navigation to current location:,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,解决方法,修改,第4张
(图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]