目录
- 问题截图
- 解决方法:
- 总结
问题截图
解决方法:
在项目根目录或 src 文件夹下找到env.d.ts,并写入以下内容:
// env.d.ts /// <reference types="vite/client" /> // 简单版本 // declare module '*.vue' // 推荐使用 declare module '*.vue' { // 引入vue模块中ts的方法 import type { DefineComponent } from 'vue' // 定义vue组件以及类型注解 const component: DefineComponent<{}, {}, any> export default component }
同时入口文件main.ts出现爆红错误如下,依照此法也可以解决:
总结
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)