ts文件从.vue文件中import报错
来源:6-2 添加路由页面基础结构

ForCoke
2022-04-30
老师,请问一下:
1、在ts文件中 import {ColumnProps} from ‘ColumnList.vue’ 它红线报错说找不到*.vue模块
2、我在项目中找到一个名为shims-vue.d.ts的文件里,它里面的内容:
/* eslint-disable */
declare module '*.vue' {
import type { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
}
这个文件是eslint帮我们创建的吗?该文件的作用是什么呢?为什么我将其添加到tsconfig的include配置中,找不到模块的这个异常就解决了呢?
写回答
1回答
-
同学你好
这个文件是应该使用脚手架创建项目的时候就会有的,而且会被 include 在 tsconfig 中,不知道你的为什么没有包含。
它的作用请参考这个问题,我回答的很详细:https://coding.imooc.com/learn/questiondetail/ZVmwRPwAnm1X1deQ.html
012022-05-02
相似问题