vue|vue3.0 typescript 创建项目,路由RouteConfig 报错 has no exported member ‘RouteConfig‘.ts

vue|vue3.0 typescript 创建项目,路由RouteConfig 报错 has no exported member ‘RouteConfig‘.ts
文章图片

vue3.0 typescript 创建项目,路由RouteConfig 报错 has no exported member 'RouteConfig'.ts
提示 ts没有对应RouteConfig
那么什么原因呢
vue3.0 ts 对这个接口已经更改了。
正确写法如下:

import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'const routes: RouteRecordRaw[] = [ { path: '/', name: 'Home', component: () => import('../views/Home.vue') }, { path: '/about', name: 'About', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') } ]const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes })export default router





【vue|vue3.0 typescript 创建项目,路由RouteConfig 报错 has no exported member ‘RouteConfig‘.ts】

    推荐阅读