当前位置: 首页 > 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.dtcms.com/a/233501.html

相关文章:

  • 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
  • 深度学习姿态估计实战:基于ONNX Runtime的YOLOv8 Pose部署全解析
  • [蓝桥杯]三体攻击
  • 上门预约行业技术方案全解析:小程序、App还是H5?如何选择?
  • P10909 [蓝桥杯 2024 国 B] 立定跳远
  • 数据驱动的智驾十年 特斯拉、Momenta合流闯进Robotaxi卫冕之战
  • OrCAD X Capture CIS设计小诀窍系列第二季--03.如何在Capture中输出带有目录和元器件信息的PDF
  • vue2中使用jspdf插件实现页面自定义块pdf下载
  • 32 C 语言字符处理函数详解:isalnum、isalpha、iscntrl、isprint、isgraph、ispunct、isspace
  • ReLU 激活函数:重大缺陷一去不复返!
  • 卫朋:AI 硬件产品怎么做?——小智AI原理解析