【问题标题】:What would it take to enable intellisense in a vue component's template html?在 vue 组件的模板 html 中启用智能感知需要什么?
【发布时间】:2018-07-09 19:31:24
【问题描述】:

我对 Vue 比较陌生,但精通 Typescript 和 Angular。我目前正在使用 vue 文档规定的 vue-class-componentvue-property-decorator 库进行打字稿路线。

我使用 VSCode 作为我的编辑器,并且根据标题,想知道是否有任何工具/插件/IDE 允许在 html 模板中自动完成/智能感知。比如说我的.ts 文件是:

hi.ts:

import { Component, Vue, Prop } from 'vue-property-decorator';

interface IInfo {
  name: string;
  age: number;
}

@Component({
  template: require('./hi.html')
})
export default HiComponent extends Vue {
  info: IInfo = { name: 'brosef', age: 30 };
}

hi.html:

<h1>name: {{ info.^ }}</h1>
<h2>age: {{ info.^ }}</h2>

是否有一个插件,或者编写一个可以在键入此模板时提供自动完成选项的方法(在上面hi.html 中的^ 位置)?也许是一个插件可以读取链接相应组件类的模板顶部的特殊注释...¯\_(ツ)_/¯

【问题讨论】:

    标签: typescript vue.js visual-studio-code vue-component


    【解决方案1】:

    使用 Vuetr VSC 扩展,因为它涉及 vue 文件中的以下所有功能 -

    1. 语法高亮

    2. 片段

    3. 格式化
    4. linting/错误检查
    5. 自动完成
    6. 调试

    【讨论】:

      【解决方案2】:

      也许您应该尝试webstorm,并安装一个 typeScript 插件来执行此操作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-03-28
        • 1970-01-01
        • 2019-05-08
        • 2021-01-10
        • 1970-01-01
        • 2023-03-08
        • 1970-01-01
        • 2016-08-03
        相关资源
        最近更新 更多