文章阅读

沉浸阅读完整内容

写文章

使用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 篇精选
文章 / 136Element-Plus分页组件默认是英文如何改成中文 文章 / 139基于Vue3,webscoket聊天室 文章 / 137饿了么Plus组件+TS+Vue3如何使用表单重置 文章 / 138bug记录P标签的内容为字母的时候不会进行自动换行需要设置word-break: break-all;

发表评论

评论 0

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

分享精彩,传递价值

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

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