发布时间: 2021-01-13 00:57:00
代码:
import VueRouter from 'vue-router' /** * 对于相同路径的跳转,不要在console中报错. */ const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => { if ( err.name !== 'NavigationDuplicated' && !err.message.includes('Avoided redundant navigation to current location') ) { logError(err); } }) } /* eslint-disable no-new */ new Vue({ components: { App }, router, store, template: '' }).$mount('#app')Back