使用unplugin-auto-import页面不引入api飘红

解决方案:.

tsconfig.json文件夹加上

{
  "compilerOptions": {
    "target": "ES2020",
    "useDefineForClassFields": true,
    "module": "ESNext",
    "lib": ["ES2020", "DOM", "DOM.Iterable"],
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "preserve",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": [
    "src/**/*.js",
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "./auto-imports.d.ts"
  ],
  "references": [{ "path": "./tsconfig.node.json" }]
}

"./auto-imports.d.ts"即可

vite-env.d.ts文件夹粘贴

/// <reference types="vite/client" />
declare module '*.vue' {
    import { ComponentOptions } from 'vue'
    const componentOptions: ComponentOptions
    export default componentOptions
}

相关推荐

  1. 自动导入组件unplugin-auto-importunplugin-vue-components

    2024-03-30 04:14:01       61 阅读
  2. onnxruntime-gpu报错怎么解决?

    2024-03-30 04:14:01       43 阅读
  3. import后加加{}的区别(es6引用

    2024-03-30 04:14:01       57 阅读
  4. 记录 unplugin-vue-components生效

    2024-03-30 04:14:01       30 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-30 04:14:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-30 04:14:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-30 04:14:01       87 阅读
  4. Python语言-面向对象

    2024-03-30 04:14:01       96 阅读

热门阅读

  1. 皮卡丘python写leetcode

    2024-03-30 04:14:01       36 阅读
  2. pathlib标准库

    2024-03-30 04:14:01       44 阅读
  3. C/C++ 一些使用网站收集...

    2024-03-30 04:14:01       42 阅读
  4. 【openGL4.x手册09】转换反馈

    2024-03-30 04:14:01       33 阅读
  5. 任务记录.

    2024-03-30 04:14:01       39 阅读
  6. 2024年最新github排行前100名项目

    2024-03-30 04:14:01       42 阅读
  7. for in 和 for of的区别

    2024-03-30 04:14:01       41 阅读
  8. 中台理念下的多应用场景平台构建与实践

    2024-03-30 04:14:01       43 阅读
  9. docker容器退出后数据丢失怎么恢复?

    2024-03-30 04:14:01       40 阅读
  10. 面试题:IoC容器的理解与实例化过程

    2024-03-30 04:14:01       39 阅读
  11. 【Python】如何入门 Python:系统化方法与实践路径

    2024-03-30 04:14:01       41 阅读
  12. 算法练习----力扣每日一题------1

    2024-03-30 04:14:01       48 阅读
  13. 阳光消费金融2023利润创新高,固收业务立功

    2024-03-30 04:14:01       40 阅读