自学内容网 自学内容网

VSCode快速生成vue组件模版

1,点击设置,找到代码片段

2,搜索vue,打开vue.json

3,添加模版

vue2模板

"vue2": {
        "prefix": "vue2",
        "body": [
            "<template>",
            "  <div>$0</div>",
            "</template>",
            "",
            "<script lang=\"ts\">",
            "export default {",
            "  components: {},",
            "  props: {},",
            "  data() {",
            "    return {",
            "    };",
            "  },",
            "  watch: {},",
            "  computed: {},",
            "  methods: {},",
            "  created() {},",
            "  mounted() {}",
            "};",
            "</script>",
            "<style lang=\"scss\" scoped>",
            "</style>"
        ],
        "description": "快速创建vue2模板"
    }

vue3模板

"vue3": {
"prefix": "vue3",
"body": [
"<template>",
"  <div></div>",
"</template>",
"",
"<script setup lang='ts'>",
"$1",
"</script>",
"",
"<style scoped lang='scss'>",
"</style>"
],
"description": "快速创建vue3模板"
}

保存vue.json文件

4,在vue文件中输入vue2或vue3就会生成模板内容,模板内容可根据自己需求修改


原文地址:https://blog.csdn.net/qq_62398643/article/details/143882378

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!