使用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
}
相关推荐
当时只道寻常7 小时前
Vue3 + IntersectionObserver 实现高性能图片懒加载
前端
sakiko_7 小时前
UIKit学习笔记3-布局、滚动视图、隐藏或显示视图
前端·笔记·学习·objective-c·swift·uikit
有一个好名字8 小时前
Agent Loop —— 一切从那个 while 循环开始
前端·javascript·chrome
一天睡25小时8 小时前
Claude Code 指令入门教程
前端
yingyima8 小时前
正则表达式实战:从日志中精准提取关键字段
前端
TeamDev8 小时前
如何在 DotNetBrowser 中使用本地 AI 模型
前端·后端·.net
谢尔登9 小时前
10_从 React Hooks 本质看 useState
前端·ubuntu·react.js
辰同学ovo9 小时前
从全局登录状态管理学习 Redux
前端·javascript·学习·react.js
陈随易9 小时前
2年没用Nodejs了,Bun很香
前端·后端·程序员
donecoding9 小时前
Corepack 完全解析:从懵到懂,包管理器自由了
前端·node.js·前端工程化