如何在 VS Code 中为模板中的 vue 道具启用 Typescript 输入和智能感知? [英] How enable Typescript typing and intellisense for vue props in template in VS Code?

查看:115
本文介绍了如何在 VS Code 中为模板中的 vue 道具启用 Typescript 输入和智能感知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用安装了 vetur 扩展的 Vue 和 VS Code.

我已经定义了一个具有两个公共属性的 MyClass 类.在脚本"部分中,我能够为 value 属性获得正确的智能感知.

但我无法检查智能感知,也无法在模板中输入强制执行.如下图.

我应该只看到 enablednumber.

如何配置我的 VS Code 以在模板上强制执行这种类型?

解决方案

使用

I'm working with Vue and VS Code with vetur extension installed.

I've defined a MyClass class with two public attributes. Inside the "script" section i'm able to get proper intelisense for the value property.

But I cannot check intellisense nor typing enforcement inside the template. as the image below.

I should see only enabled and number.

How can I configure my VS Code to get this type enforcement on the template?

解决方案

Using Vetur extension:

In settings:

"vetur.experimental.templateInterpolationService": true,

这篇关于如何在 VS Code 中为模板中的 vue 道具启用 Typescript 输入和智能感知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆