zoukankan      html  css  js  c++  java
  • Vscode自定义用户模板

    Vscode配置路径:

    中文版:

    文件-->首选项-->用户片段

    英文版:

    file-->preferences-->user snippets

    选择相应的文件类型,此处以vue为例

     然后进入到 vue.json配置文件。配置内容如下:

    {
        // 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-temp": {
            "prefix": "vue-tem",
            "body": [
                "<template>",
                "  <div class="">",
                "  </div>",
                "</template>",
                "<script>",
                "import {testdata} from '@/api/api';",
                "export default {",
                "  data() {",
                "    return {",
                "  }",
                "},",
                "  methods: {",
                "    init(){",
    
                "  }",
                "},",
                "  components: {},",
                "  created() {},",
                "  mounted() {",
                "    this.init()",
                "  }",
                "}",
                "</script>",
                "<style lang="scss">",
    
                "</style>",
            ],
            "description": "快速创建bue模板"
        }
    }

    保存后,新建一个 a.vue文件,输入 vue- 即可出现选择模板,选择后即可:

     备注:

    "vue-temp" 

    是模板名字。

    "prefix": ""这里规定的是触发模板的关键词,我这里规定触发词为vue。

  • 相关阅读:
    HDU3336 Count the string(kmp
    HDU2087 剪花布条(字符串...半暴力写的?
    HDU4763 Theme Section(kmp
    HDU1251 统计难题(字典树|map
    HDU1305 Immediate Decodability (字典树
    priority_queue member function
    HDU
    洛谷 P3370 【模板】字符串哈希 (set||map||哈希||字典树(mle)
    mysql (master/slave)复制原理及配置
    mysql备份小记
  • 原文地址:https://www.cnblogs.com/lanyueff/p/12611019.html
Copyright © 2011-2022 走看看