使用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
}
相关推荐
速易达网络23 分钟前
Bootstrap 5 响应式网站首页模板
前端·bootstrap·html
etsuyou24 分钟前
js前端this指向规则
开发语言·前端·javascript
lichong95125 分钟前
Android studio 修改包名
android·java·前端·ide·android studio·大前端·大前端++
cai_huaer26 分钟前
BugKu Web渗透之 cookiesWEB
前端·web安全
lichong95127 分钟前
Git 检出到HEAD 再修改提交commit 会消失解决方案
java·前端·git·python·github·大前端·大前端++
友友马1 小时前
『 QT 』QT控件属性全解析 (一)
开发语言·前端·qt
不想上班只想要钱1 小时前
vue3+vite创建的项目,运行后没有 Network地址
前端·javascript·vue.js
流***陌2 小时前
手办盲盒抽赏小程序前端功能设计:兼顾收藏需求与抽赏乐趣
前端·小程序
岁月宁静2 小时前
在富文本编辑器中封装实用的 AI 写作助手功能
前端·vue.js·人工智能
金士顿2 小时前
为什么MainWindow.xaml绑定的datacontext,EtherCATSuiteCtrl.xaml直接用了?
前端