美文网首页
初始化Vue Router4

初始化Vue Router4

作者: 曾祥辉 | 来源:发表于2021-03-25 11:04 被阅读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);

相关文章

网友评论

      本文标题:初始化Vue Router4

      本文链接:https://www.haomeiwen.com/subject/zqmhhltx.html