简体   繁体   English

在 Vue 2 / Nuxt / Typescript / @nuxtjs-composition-api 项目中使用 VSCode Volar 扩展

[英]Use of VSCode Volar extension for a Vue 2 / Nuxt / Typescript / @nuxtjs-composition-api project

I'm trying to setup the Volar VSCode extension to work with a NuxtJS / Typescript project.我正在尝试设置 Volar VSCode 扩展以使用 NuxtJS/Typescript 项目。 I currently face these two problems in my .vue file templates.我目前在我的 .vue 文件模板中面临这两个问题。 I followed the installation recommendations for Vue 2 and Typescript as well as enabling Take Over mode .我遵循了 Vue 2 和 Typescript 的安装建议,并启用了接管模式

I've managed to fix some issues that happened in my codebase with the extension but these two remain.我已经设法通过扩展修复了我的代码库中发生的一些问题,但这两个问题仍然存在。

Vue 3 deprecation warnings Vue 3 弃用警告

(deprecation COMPILER_V_ON_NATIVE) .native modifier for v-on has been removed as is no longer necessary.
  Details: https://v3.vuejs.org/guide/migration/v-on-native-modifier-removed.htmlvue(COMPILER_V_ON_NATIVE)

I would like to find a way to silence these warnings since I'm still using Vue 2 (NuxtJS is not yet compatible with Vue 3).我想找到一种方法来消除这些警告,因为我仍在使用 Vue 2(NuxtJS 尚不与 Vue 3 兼容)。

Custom event handlers , for example I have this event handler on a custom <Modal> component.自定义事件处理程序,例如我在自定义<Modal>组件上有这个事件处理程序。

@modal-confirmation="onModalConfirmed"

const onModalConfirmed = (modalConfirmation: ModalConfirmation) => {};

Type '(modalConfirmation: ModalConfirmation) => void' is not assignable to type '(...payload: unknown[]) => unknown'.
  Types of parameters 'modalConfirmation' and 'payload' are incompatible.ts(2322)

Anyone went through this process before ?以前有人经历过这个过程吗?

According to @johnsoncodehk on Volar's GitHub :根据@johnsoncodehkVolar 的 GitHub说法:

I would like to find a way to silence these warnings since I'm still using Vue 2 (NuxtJS is not yet compatible with Vue 3).我想找到一种方法来消除这些警告,因为我仍在使用 Vue 2(NuxtJS 尚不与 Vue 3 兼容)。

We need to change experimentalCompatMode option for this, but this option design behavior is not finalize yet.我们需要为此更改experimentalCompatMode 选项,但此选项的设计行为尚未最终确定。 So it will not change in a short time.所以短时间内不会改变。

@vue/composition-api events type fixed in 953cb2d. @vue/composition-api 事件类型已在 953cb2d 中修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM