Vscode设置Vue的模板

206 阅读1分钟

1、打开VSCODE编辑器,依次选择“文件 -> 首选项 -> 用户代码片段” 选vue.json文件,替换以下内容并保存。

{
  "Print to console": {
    "prefix": "vue",
    "body": [
      "<template>",
      "  <div></div>",
      "</template>",
      "",
      "<script>",
      "export default {",
      "  data () {",
      "    return {",
      "    };",
      "  },",
      "",
      "  components: {},",
      "",
      "  computed: {},",
      "",
      "  mounted: {},",
      "",
      "  methods: {}",
      "}",
      "",
      "</script>",
      "<style lang='scss' scoped>",
      "</style>"
  ],
    "description": "Log output to console"
  }
}

2、在VsCode工作区创建一个Vue组件的文件,在文件内输入vue按Enter键就会生成vue组件模板。