文章阅读

沉浸阅读完整内容

写文章

使用vue3+TS提示模块无法找到。

正在统计阅读人数 正在统计字数
登录收藏0
字号 100%

创建页面也可以正常访问,但是ts报错找不不到模块,可以尝试使用下面方法解决

1.在根目录下面创建 shims-vue.d.ts ,放入下面代码,如果第二和代码段不行,可以尝试第一个。


// declare module '*.vue' {
//     import type { DefineComponent } from 'vue'
//     const component: DefineComponent<{}, {}, any>
//     export default component
// }

declare module '*.vue' {
    import type { DefineComponent } from 'vue'
    const component: ComponentOptions | ComponentOptions['setup']
    export default component
}

推荐阅读

4 篇精选
文章 / 67vue 解决路径多次点击报错 文章 / 64自定义颜色主题 文章 / 66登录模板 文章 / 65vue中设置网页标题

发表评论

评论 0

还没有评论,欢迎留下第一条讨论。

分享精彩,传递价值

生成专属海报,分享你的文章,让更多人发现好内容

浏览器不支持 Canvas,无法生成海报。

每日签到

每天来这里,记录一点持续积累。

当前积分--积分
本月签到--
本月获得--积分
正在读取