文章图片
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】
推荐阅读
- Vue|vue-property-decorator用法详解
- 定位|Vue.js开发移动端经验总结
- ECMAScript|JavaScript性能优化具体实现-第二篇
- vue|发布angular指令,vue指令,js文件到npm的流程
- java项目精品实战案例|基于Java+SpringMvc+vue+element实现校园闲置物品交易网站
- vue|vue @input带参数_Vue组件通信详解
- 兼容|vue-cli2在IE浏览器下的兼容问题
- vue|vue学习总结笔记
- vue|vue 学习总结笔记(三)