vue2-s-cli
Version:
脚手架
29 lines (25 loc) • 646 B
JavaScript
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// 解决路由重复的问题
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err);
};
const routes = [
{ path: "/", redirect: "/AuthorPage" },
{
path: "/Author",
name: "Author",
component: () => import("../views/Author.vue"),
},
{
path: "/AuthorPage",
name: "AuthorPage",
component: () => import("../views/AuthorPage.vue"),
}
]
const router = new VueRouter({
routes
})
export default router