美文网首页
vscode用户片段

vscode用户片段

作者: 码农梦醒 | 来源:发表于2021-06-24 18:12 被阅读0次
{
    // Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
    // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
    // same ids are connected.
    // Example:
    // "Print to console": {
    //  "prefix": "log",
    //  "body": [
    //      "console.log('$1');",
    //      "$2"
    //  ],
    //  "description": "Log output to console"
    // }
    "Print vue2 component template": {
        "prefix": "pzyvue2",
        "body": [
            "<template>",
            "  <div>$1 $TM_FILENAME_BASE</div>"
            "</template>",
            "",
            "<script>",
            "export default {",
            "  name: '$TM_FILENAME_BASE',",
            "  props: {},",
            "  data() {",
            "    return {}",
            "  },",
            "  computed: {},",
            "  created() {",
            "    console.log('组件 $TM_FILENAME_BASE 创建!')",
            "  },",
            "  updated() {",
            "    console.log('组件 $TM_FILENAME_BASE 更新!')",
            "  },",
            "  methods: {},",
            "}",
            "</script>"
            "",
            "<style lang=\"scss\" scoped></style>"

        ],
        "description": "输出vue2组件模板"
    },
    "Print vue3 component template": {
        "prefix": "pzyvue3",
        "body": [
            "<template>",
            "  <div>$1 $TM_FILENAME_BASE</div>"
            "</template>",
            "",
            "<script lang=\"ts\">",
            "import { defineComponent, toRefs, ref, reactive } from 'vue'",
            "export default defineComponent({",
            "  name: '$TM_FILENAME_BASE',",
            "  props: {},",
            "  emits: {},",
            "  setup(props, { attrs, slots, emit }) {",
            "    const { title } = toRefs(props)",
            "    const readersNumber = ref<Number>(0)",
            "    const book = reactive({ title: 'Vue 3 Guide' })",
            "    return {}",
            "  },",
            "  data() {",
            "    return {}",
            "  },",
            "  computed: {},",
            "  created() {",
            "    console.log('组件 $TM_FILENAME_BASE 创建!')",
            "  },",
            "  updated() {",
            "    console.log('组件 $TM_FILENAME_BASE 更新!')",
            "  },",
            "  methods: {},",
            "})",
            "</script>"
            "",
            "<style lang=\"scss\" scoped></style>"

        ],
        "description": "输出vue3组件模板"
    }
}

相关文章

网友评论

      本文标题:vscode用户片段

      本文链接:https://www.haomeiwen.com/subject/gkrpyltx.html