沃梦达 / IT编程 / 前端开发 / 正文

VsCode快速生成vue代码片段

1.点击文件 首选项 用户代码片段 2.新建或修改vue.json 3.将下列代码粘贴上去(可根据自己需要添加/删除){Print to console: {prefix: vue,body: [template, div\n, /div,/template...

1.点击文件 > 首选项 > 用户代码片段

2.新建或修改vue.json
3.将下列代码粘贴上去(可根据自己需要添加/删除)

{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            "  <div>\n",
            "  </div>",
            "</template>\n",
            "<script>",
            "export default {",
            "  name:\"\",",
            "  components: {},",
            "  props: {},",
            "  data() {",
            "    return {};",
            "  },",
            "  computed: {},",
            "  watch: {},",
            "  created() {},",
            "  mounted() {},",
            "  activited() {},",
            "  update() {},",
            "  filters: {},",
            "  methods: {},",
            "};",
            "</script>\n",
            "<style lang=\"${1:scss}\" scoped>\n",
            "</style>\n",
        ],
        "description": "Create vue template"
    }
}

4.在新建的vue文件里面打’vue’敲回车代码片就自动生成了

本文标题为:VsCode快速生成vue代码片段