自定义编辑器代码块

{
    // 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"
    // }
    "vue-component": {
        "prefix": "vue-component",
        "body": [
            "<template>",
            "\t<div class=\"$0\">\n",
            "\t</div>",
            "</template>\n",
            "<script>",
            "\texport default {",
            "\tname: \"$0\",",
            "\tprops: {\n",
            "\t},",
            "\tdata() {",
            "\t\treturn {\n",
            "\t\t}",
            "\t},",
            "\twatch: {\n",
            "\t},",
            "\tcomputed: {\n",
            "\t},",
            "\tmethods: {\n",
            "\t},",
            "\tcreated() {\n",
            "\t},",
            "\tmounted() {\n",
            "\t},",
            "\tupdated() {\n",
            "\t},",
            "\tdestroyed() {\n",
            "\t}",
            "}",
            "</script>\n",
            "<style lang=\"scss\" scoped>",
            ".$0{\n",
            "}",
            "</style>"
        ],
        "description": "vue componemt"
    },
    "vue-template": {
        "prefix": "vue-template",
        "body": [
            "<template>",
            "\t<div class=\"$0\">\n",
            "\t</div>",
            "</template>\n",
            "<script>",
            "export default {",
            "\tname: \"$0\",",
            "\tcomponents: {\n",
            "\t},",
            "\tdata() {",
            "\t\treturn {\n",
            "\t\t}",
            "\t},",
            "\twatch: {\n",
            "\t},",
            "\tcomputed: {\n",
            "\t},",
            "\tmethods: {\n",
            "\t},",
            "\tcreated() {\n",
            "\t},",
            "\tmounted() {\n",
            "\t},",
            "\tupdated() {\n",
            "\t},",
            "\tdestroyed() {\n",
            "\t}",
            "}",
            "</script>\n",
            "<style lang=\"scss\" scoped>",
            ".$0{\n",
            "}",
            "</style>"
        ],
        "description": "vue-template"
    },
    "vue3-ts": {
        "prefix": "vue3-ts",
        "body": [
            "<template>",
            "\t<div></div>",
            "</template>\n",
            "<script setup lang=\"ts\">",
            "\timport { defineProps, defineEmits, ref, reactive, onMounted } from \"vue\"\n",
            "\tinterface Props {",
            "\t\tfoo: string",
            "\t\tbar?: number",
            "\t};",
            "\tconst { foo, bar } = defineProps<Props>();\n",
            "\tconst emit = defineEmits<{ (e: 'change', id: number): void, (e: 'update', value: string): void }>();",
            "\temit('change', 1);",
            "\temit('update', 'hello world');\n",
            "\tconst ref1 = ref<string | number>('2020')\n",
            "\tinterface Book {",
            "\t\ttitle: string",
            "\t\tyear?: number",
            "\t};",
            "\tconst react1: Book = reactive({ title: 'Vue 3 指引' });\n",
            "\tonMounted(() => {});",
            "</script>\n",
            "<style scoped lang=\"scss\"></style>",
        ],
        "description": "vue3-ts"
    }
}
posted @ 2019-12-18 16:24  只争朝夕,不负韶华  阅读(534)  评论(0编辑  收藏  举报