vue路由常用代码

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
// // 路由前置导航守卫
router.beforeEach((to, from, next) => {
// 根据路由元信息设置文档标题
window.document.title = to.meta.title
next()
})
两段常用的vue代码