Home  >  Article  >  Web Front-end  >  How to use .vue code in vscode

How to use .vue code in vscode

php中世界最好的语言
php中世界最好的语言Original
2018-06-01 14:39:261716browse

这次给大家带来怎样操作vscode内使用.vue代码,操作vscode内使用.vue代码的注意事项有哪些,下面就是实战案例,一起来看一下。

1.设置.vue模板

打开编辑器,点击文件 —— 首选项 —— 用户代码片段,会弹出来一个输入框。

在输入框输入vue,回车,会打开一个vue.json文件。

在里面复制以下代码:

{
 "Print to console": {
   "prefix": "vue",
   "body": [
     "<template>",
     " <p class=\"container\">\n",
     " </p>",
     "</template>\n",
     "<script>",
     "export default {",
     " data() {",
     "  return {\n",
     "  }",
     " },",
     " components: {\n",
     " }",
     "}",
     "</script>\n",
     "<style scoped lang=\"scss\">\n",
     "</style>",
     "$2"
   ],
   "description": "Log output to console"
 }
}

模板内容可按自己的喜好自行修改。

然后新建一个.vue文件,输入vue然后按tab键。

2.如果第一步没有成功

如果第一步成功是最好的,万一按tab键没有成功生成模板,而是多了一个空格:

步骤一:点击文件 —— 首选项 —— 设置,修改以下设置:

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

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

怎样进行JS内DOM节点使用

使用缓存调用链实现JS方法重载步骤详解

The above is the detailed content of How to use .vue code in vscode. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn