学无先后,达者为师

网站首页 Vue 正文

vue-router的4.0.0-alpha.6中的component

作者:py_boy 更新时间: 2022-03-02 Vue
import effect from '@/pages/effect.vue';
// effect通过import导出的方式会爆出类型不匹配,component识别出的类型为undefined
const router = createRouter({
	routes: [
      {
        path: '/',
        name: 'login',
        component: () => import('@/pages/login/login.vue')
      },
      {
        path: '/reactive',
        component: () => import('@/pages/login/reactive.vue')
      },
      {
        path: '/effect',
        component: effect
      }
    ]
})

在这里插入图片描述
通过异步组件就可以规避类型报错

原文链接:https://blog.csdn.net/py_boy/article/details/108124342

栏目分类
最近更新