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

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.xdnf.cn/news/12130.html

相关文章:

  • 华为云Flexus+DeepSeek征文| 华为云Flexus X实例单机部署Dify-LLM应用开发平台全流程指南
  • Vue ②-computed || watch || 指令
  • oracle数据恢复—oracle数据库执行truncate命令后的怎么恢复数据?
  • deepseek-r1-0528-qwen3-8b本地部署:Ollama老版本大升级至0.9.0
  • Three.js光与影代码分析及原理阐述
  • C++STL-sting类的模拟实现
  • nginx.conf配置详解:从(413 Request Entity Too Large)说起
  • Scrum基础知识以及Scrum和传统瀑布式开发的区别
  • 计算机磁盘旁黄色警示标志消除|BitLocker关闭方法
  • <论文>(微软)WINA:用于加速大语言模型推理的权重感知神经元激活
  • 众趣科技与我爱我家达成战略合作:AI空间计算技术赋能重塑房产服务新范式
  • 服务器安装软件失败或缺依赖怎么办?
  • 使用vue3+ts+input封装上传组件,上传文件显示文件图标
  • 【试卷篇】Spring面试试卷题
  • POP3、IMAP、SMTP:三大邮件协议核心差异与应用场景解析
  • IO流听不懂?如何快速上手
  • 解读《网络安全法》最新修订,把握网络安全新趋势
  • 理解电池的极化:极化内阻与欧姆内阻解析
  • 在NLP文本处理中,将字符映射到阿拉伯数字(构建词汇表vocab)的核心目的和意义
  • 网络原理3—TCP 2
  • 数据驱动的智驾十年 特斯拉、Momenta合流闯进Robotaxi卫冕之战
  • 使用 Docker Compose 安装 PostgreSQL 16
  • css实现文字颜色渐变
  • 直线导轨微型化技术难点在哪里?
  • python项目中,。 __all__ = [‘StorageConfig‘] 这个__all__ 代表什么含义
  • uboot移植之GPIO上电初始状态的调整
  • HarmonyOS-ArkUI 自定义弹窗
  • 企业im,为企业设计的私有化即时通讯工具
  • [蓝桥杯]修改数组
  • 智慧充电:新能源汽车智慧充电桩的发展前景受哪些因素影响?