初始化Vue Router4

2021-03-25  本文已影响0人  曾祥辉
import { createWebHashHistory, createRouter } from 'vue-router';
const history = createWebHashHistory();
const router = createRouter({
    history,
    routes: [
        {
            path: '/',
                    component: () => import('./views/*.vue')
        },
        {
            path: '/:pathMatch(.*)*',
            redirect: '/home'
        }
    ]
});
const app = createApp(App);
app.mount('#app');
app.use(router);
上一篇 下一篇

猜你喜欢

热点阅读