zl程序教程

您现在的位置是:首页 >  前端

当前栏目

vue3 报错解决:找不到模块‘xxx.vue’或其相应的类型声明。(Vue 3 can not find module)

Vue3Vue模块 报错 解决 类型 not 不到
2023-06-13 09:15:05 时间

在 使用 vue ts 语言开发项目的过程中,会遇到,导入 vue 文件后,提示 找不到模块‘xxx.vue’或其相应的类型声明。(Vue 3 can not find module)

解决方式:

在项目根目录新建一个 xx.d.ts

declare module '*.vue' {
  import { ComponentOptions } from 'vue'
  const componentOptions: ComponentOptions
  export default componentOptions
}

保存之后,再看刚才编辑器的波浪线报错已经消失了。

转载自