请问一下如何让vscode在vue的组件当中的template支持emment语法?

每次都一个一个敲感觉很不习惯图片描述

还是没用啊,有点尴尬。。

阅读 4.1k
3 个回答

最佳扩展 vetur

Emmet:

  • In your user settings, set

    "emmet.syntaxProfiles": {
      "vue-html": "html",
      "vue": "html"
    }

ESLint for linting <script> section:

  • Install ESLint extension

  • Add vue to your eslint.validate setting, for example:

    "eslint.validate": [
      "javascript",
      "javascriptreact",
      "vue"
    ]

Stylus:

VSCode < 1.10

  • In your user settings, set

    "files.associations": {
      "*.vue": "vue"
    }

Roadmap

  • [x] Build a language server

  • [x] IntelliSense for css/scss

  • [x] Basic IntelliSense for js/es6 in <script>

  • [x] Error checking for css/scss/less

  • [x] Snippet for embedded languages

  • [x] Embedded formatter for html/css/scss/less/js

  • [x] Advanced IntelliSense (In progress, see #26)

  • [ ] Jump to definition

  • [ ] Debugging embedded JS by setting breakpoints directly

https://marketplace.visualstu...

ctrl+shift+x打开vscode扩展中心,搜vue,安装一个热度最高的vue扩展组件就可以了。

clipboard.png

今天刚好也遇到在vue文件中不能使用emmet的情况。
之前我是可以用的,不知为何突然就跪了,在GitHub上搜了一波,发现是配置文件要改一下。
之前的写法是:

"emmet.syntaxProfiles": {
  "vue-html": "html",
  "vue": "html"
}

现在改成:(PS:我改成这样就ok了,不知道其他情况是否适用)

"emmet.includeLanguages": {
  "vue-html": "html",
  "vue": "html"
}

希望可以帮到有同样问题的小伙伴 =。=
issuse地址:issuse

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题