在router的index.js文件夹里面配置
router.beforeEach((to, from, next) => {
console.log(to, from);
// 判断是否为复制的地址栏中的链接
const isCopiedLink = !from.name && to.path !== '/'
if (isCopiedLink) {
// 如果是复制的链接,则重定向到首页
next({ path: '/' })
} else {
next()
}
})