当前位置: 首页 > 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"]
}

在这里插入图片描述

相关文章:

  • qt network 整体框架
  • 群晖NAS如何在虚拟机创建飞牛NAS
  • vue3+js示例
  • Android 本地存储路径说明
  • Android基础回顾】六:安卓显示机制Surface 、 SurfaceFlinger、Choreographer
  • 低功耗高安全:蓝牙模块在安防系统中的应用方案
  • 前端常见错误
  • 高通camx Node相关
  • IP证书与 域名证书有什么区别?
  • Flyway
  • python条件语句及input函数的使用与理解(附实战代码)
  • “产业大脑”核心功能全景解析
  • 大模型面试题总结
  • 【高等数学】函数项级数
  • Linux目录结构
  • OA系统与ERP管理系统的核心差异与协同价值
  • 小程序引入deepseek
  • 青岛国瑞数据采集网关软件平台:工业互联的智能基石——安全、高效、开放,驱动企业数字化转型
  • ubuntu 端口复用
  • 在 Spring Boot 中使用 JSP
  • 像淘宝购物网站建设需要哪些专业人员/百度seo搜索引擎优化培训
  • 计算机科学与技术/百度seo规则最新
  • 如何自己做一个网站/免费推广引流平台有哪些
  • 城桥微信网站设计制作/2023免费推广入口
  • 比较好看的网站设计/目前最好的引流推广方法
  • scratch编程网站/手机怎么搭建网站