Vue-Router4.0 报“Cannot read prop

2022-10-26  本文已影响0人  我一不小心就

注意:这个名字一定要叫routes不能为其他名称,否则报错

// 这个名字一定要叫routes不能为其他名称,否则报错
const routes = [
    {
        path: "/",
        name: 'home',
        component: Home,
    }
]

// 2.初始化创建VueRouter实例
const router = createRouter({
    history: createWebHistory(),
    routes
})
上一篇 下一篇

猜你喜欢

热点阅读