版本号:
vue/cli:4.5.12
@vue/cli-plugin-router: ~4.5.0
const router = createRouter({
history: createWebHashHistory(),
routes: [{
name: 'Home',
path: '/',
component: () => import( /* webpackChunkName: "home" */ '../views/home/index.vue'),
},{
path: '/:pathMatch(.*)',
redirect: {
name: 'Home'
}
}]
})
参考文章:
官方vue-router