Error: Avoided redundant navigation to current location: "/X".
解决:在router文件夹下的index.js中加入代码:
import Vue from 'vue'
import Router from 'vue-router'
import Chat from '../components/Chat.vue'
import User from '../components/User.vue'
import Find from '../components/Find.vue'
import My from '../components/My.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
component: Chat
},
{
path: '/User',
component: User
},
{
path: '/Find',
component: Find
},
{
path: '/My',
component: My
}
]
})
// 解决报错的代码
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
版权声明:本文为weixin_43675447原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。