当前位置: 首页 > news >正文

Vue3解决“找不到模块@/components/xxx.vue或其相应的类型声明ts文件(2307)”

1:如果没有这个env.d.ts文件,就新建

declare module "*.vue" {import { DefineComponent } from "vue";const component: DefineComponent<{}, {}, any>;export default component;
}

在这里插入图片描述

2:如果需要使用@简写访问src如下

2-1:如果没有这个etsconfig.json文件,就新建

{"compilerOptions": {"target": "esnext","useDefineForClassFields": true,"module": "esnext","moduleResolution": "node","strict": true,"jsx": "preserve","sourceMap": true,"resolveJsonModule": true,"esModuleInterop": true,"lib": ["esnext", "dom"],"baseUrl": "./","allowJs": true,"forceConsistentCasingInFileNames": true,"allowSyntheticDefaultImports": true,"strictFunctionTypes": false,"noUnusedLocals": true,"noUnusedParameters": true,"experimentalDecorators": true,"noImplicitAny": false,"skipLibCheck": true,"paths": {"@/*": ["src/*"]},"types": [// "@intlify/unplugin-vue-i18n/types","vite/client"// "element-plus/global",// "@types/qrcode",// "vite-plugin-svg-icons/client"],"outDir": "target", // 请保留这个属性,防止tsconfig.json文件报错"typeRoots": ["./node_modules/@types/", "./types"]},"include": ["src","types/**/*.d.ts","src/types/auto-imports.d.ts","src/types/auto-components.d.ts"],"exclude": ["dist", "target", "node_modules"]
}

在这里插入图片描述

http://www.lqws.cn/news/158905.html

相关文章:

  • BLOB 是用来存“二进制大文件”的字段类型
  • GO协程(Goroutine)问题总结(待续)
  • 自建 Derp 中继节点
  • [蓝桥杯]航班时间
  • RK3588 InsightFace人脸识别移植及精度测试全解析
  • UE Learning Record
  • 在嵌入式中C语言中static修饰的变量常量和字符串常量存储位置
  • EFI(x64)简易开发环境
  • 优化Docker容器化安装与配置的最佳实践
  • 将图形可视化工具的 Python 脚本打包为 Windows 应用程序
  • Java线程安全集合类
  • 贪心,回溯,动态规划
  • HTV 3.3 | 秒播无卡顿 直播源每天维护更新
  • 【定昌linux开发板】关闭ssh 端口 22
  • Rocketmq消息队列 消息模型 详解
  • 虚拟机网络配置
  • css实现文字颜色渐变
  • 深入理解汇编语言子程序设计与系统调用
  • 第十三节:第四部分:集合框架:HashMap、LinkedHashMap、TreeMap
  • MCP通信方式之Streamable HTTP
  • 开始在本地部署自己的 Gitea 服务器
  • 在 Windows 系统安装 Git
  • [Git] 分布式版本控制 远程仓库协作
  • 右值引用和移动语义
  • 基于WSL搭建Ubnutu 20.04.6 LTS(二)-部署Docker环境
  • uniapp中使用aixos 报错
  • echarts在uniapp中使用安卓真机运行时无法显示的问题
  • SSL/TLS握手全流程拆解:从“Hello“到“安全通道“的每一个字节
  • Excel处理控件Aspose.Cells教程:使用 C# 从 Excel 进行邮件合并
  • uniappx插件nutpi-idcard 开发与使用指南(适配鸿蒙)