使用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
}
相关推荐
小满zs35 分钟前
Next.js第十六章(font字体)
前端·next.js
喝拿铁写前端6 小时前
别再让 AI 直接写页面了:一种更稳的中后台开发方式
前端·人工智能
A向前奔跑7 小时前
前端实现实现视频播放的方案和面试问题
前端·音视频
十一.3667 小时前
131-133 定时器的应用
前端·javascript·html
xhxxx8 小时前
你的 AI 为什么总答非所问?缺的不是智商,是“记忆系统”
前端·langchain·llm
3824278279 小时前
python:输出JSON
前端·python·json
2503_928411569 小时前
12.22 wxml语法
开发语言·前端·javascript
光影少年9 小时前
Vue2 Diff和Vue 3 Diff实现及底层原理
前端·javascript·vue.js
傻啦嘿哟9 小时前
隧道代理“请求监控”实战:动态调整采集策略的完整指南
前端·javascript·vue.js