vue中路由跳转报错
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
·
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)
}
更多推荐
已为社区贡献3条内容
所有评论(0)