Vue - Official插件升级vue文件报错

1.兼容性问题

Volar这一块强大的插件升级之后变成Vue - Official,但是这个兼容性的问题还是存在不少的,比如# automatically enable Hybrid Mode,github社区上给出的答案,是把原来的auto改成true

2.创建的vue文件报错

自己创建的vue文件 和在 router路由文件中,使用的组件也会莫名的报错 大概提示为: 没有声明这些组件, ts无法识别
解决办法: 自己声明创建的vue文件(在 env.d.ts 中声明)

js 复制代码
/// <reference types="vite/client" />

declare module "*.vue" {
  import type { DefineComponent } from "vue"
  const component: DefineComponent
  export default component
}

3.升级Vue - Official 的版本后,初始化 JS/TS 语言服务会崩溃

The JS/TS language service immediately crashed 5times. The service will not be restarted. This may becaused by a plugin contributed by one of theseextensions: Vue.volar. Please try disabling theseextensions before filing an issue against VS Code.

解决方案是降级 github.com/vuejs/langu... 注意:这个针对的版本是 v2.0.3 不过现在最新的Vue - Official版本2.0.11(时间是24年4月10号安装),已经解决的这个问题

4.Vue - Official插件的一些优点

4.1.同名属性的简写

js 复制代码
<template>
   <div class="home">
     <home :itemData="itemData"/>
   </div>
</template>

同名属性的简写

js 复制代码
<template>
   <div class="home">
     <home :itemData/>
   </div>
</template>

4.2. 拖拽导入组件

Mac电脑,需要先试用 command键, 拖动需要拖拽的 vue组件, 到编辑区域, 然后切换 shift

相关推荐
前端小D1 分钟前
JS模块化
开发语言·前端·javascript
Muen9 分钟前
iOS开发-适配XCode26、iOS26
前端
卸任33 分钟前
Electron霸屏功能总结
前端·react.js·electron
fengci.33 分钟前
ctfshow黑盒测试前半部分
前端
喵个咪44 分钟前
Headless 架构优势:内容与展示解耦,一套 API 打通全端生态
前端·后端·cms
小江的记录本1 小时前
【JEECG Boot】 JEECG Boot——数据字典管理 系统性知识体系全解析
java·前端·spring boot·后端·spring·spring cloud·mybatis
喵个咪1 小时前
传统 CMS 太笨重?试试 Headless 架构的 GoWind,轻量又强大
前端·后端·cms
chenjingming6661 小时前
jmeter导入浏览器上按F12抓的数据包
前端·chrome·jmeter
张元清1 小时前
不用 Server Components 也能做 React 流式 SSR —— 实战指南
前端·javascript·面试