Vue 路由跳转报错 Error: Avoided redundant navigation to current location: "/XXX".
在router文件夹下的index.js中加入红色字体代码即可解决
import Vue from 'vue' import VueRouter from 'vue-router' Vue.use(VueRouter) const routes = [ { path: '/', name: 'Login', component: () => import('../views/Login.vue') }, { path: '/login', name: 'Login', component: () => import('../views/Login.vue') }, { path: '/home', name: 'Home', component: () => import('../views/Home.vue') } ] const router = new VueRouter({ routes }) const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) } export default router
本文来自博客园,作者:liessay,转载请注明原文链接:https://www.cnblogs.com/liessay/p/13203808.html