首页 > 其他分享 >Vite+Vue3+TS 自定义全局组件,无法不能高亮解析的解决办法

Vite+Vue3+TS 自定义全局组件,无法不能高亮解析的解决办法

时间:2023-02-07 18:22:38浏览次数:42  
标签:vue 自定义 TS ts unplugin add components Vue3

检查package.json中的devDependencies是否安装@vue/runtime-core依赖,没有的话,安装后重启VS Code

一、安装依赖

$ yarn add @vue/runtime-core -D
$ yarn add unplugin-vue-components -D

二、配置

vite.config.ts

import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

{
    plugins: [
      Components({
        extensions: ['vue'],
        include: [/\.vue$/, /\.vue\?vue/],
        resolvers: ElementPlusResolver()
      })
    ]
}

tsconfig.json

{
    "include": [
        "./components.d.ts",
    ]
}

三、重启 VS Code

标签:vue,自定义,TS,ts,unplugin,add,components,Vue3
From: https://www.cnblogs.com/former/p/17099423.html

相关文章

  • ESL中如何自定义事件及自定义事件的监听
    虽然freeswitch已经内置了一些标识的事件,比如:CHANNEL_CREATE(发起呼叫时触发),CHANNEL_HANGUP_COMPLETE(电话挂断时触发)...,但是有时候我们想根据业务需求,新增一些自定义的事......
  • HDU 5418 Victor and World 状压DP的TSP问题
     VictorandWorldTimeLimit:4000/2000MS(Java/Others)    MemoryLimit:262144/131072K(Java/Others)TotalSubmission(s):1855    AcceptedSubmission......
  • POJ 3311 Hie with the Pie 状态压缩DP TSP问题(两种方法)
    HiewiththePieTimeLimit: 2000MS MemoryLimit: 65536KTotalSubmissions: 9728 Accepted: 5250DescriptionThePizazzPizzeriapridesitselfindeliveringpi......
  • vue3+ts基础使用
    详见:vue官方文档响应式数据<scriptsetuplang="ts">import{ref,reactive,computed}from"vue";importtype{Ref}from"vue";//ref//可通过Ref或......
  • How to set the sprint goal before each quarter and pull the tickets into the cur
    ①IfoundtheepicIwanttodoandcreatedtheticketstodo  ②ThenIfoundmyticketinthebacklog  ③Rightclickandselec......
  • vue3新增特性合集
    封装公共方法到原型上再vue2中全局挂载方法使用的是Vue.prototype.xxx的形式来挂载的,但是在vue3中这个方法将不能使用,取而代之的是app.config.globalProperties......
  • java对自定义类型的两种排序方法(Arrays.sort和Collections.sort)
    前言对普通基本类型的数组或者集合sort都有相应的排序方法(从小到大),但是对于我们自定义的类型,就需要重新定义比较器,这里介绍对对象数组排序的Arrays.sort和对集合排序的Coll......
  • UVA12096 The SetStack Computer 栈的应用 好题
    题意翻译对于一个以集合为元素的栈,初始时栈为空。输入的命令有如下几种:PUSH:将空集{}压栈DUP:将栈顶元素复制一份压入栈中UNION:先进行两次弹栈,将获得的集合A和B取并集,将结......
  • Qt::WA_TransparentForMouseEvents
    (一)Qt::WA_TransparentForMouseEvents实现鼠标穿透功能,类似“隔空取物、隔山打牛”的效果。//qwidget.hvoidsetAttribute(Qt::WidgetAttribute,boolon=true);启......
  • SOLIDWORKS物料编码工具SolidKits Coding
    一、编码的重要性:在当今信息化和数字化的时代,编码无处不在,且不可或缺。编码的生成、应用、查询,是各种信息化工具和数据管理最基本、最频繁、最重要的操作,是保证一切数据有......