在添加如下步骤后报错,但是不影响使用:

activated(){
   this.$router.push(this.path);
},

解决办法:

在router文件夹下的index.js中加入如下代码,错误消失

import Vue from 'vue'
import VueRouter from 'vue-router'
//import HelloWorld from '@/components/HelloWorld'
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

 

Logo

前往低代码交流专区

更多推荐