• 手把手--vs code 自定义快捷模块输入


    直接进入话题,手把手自己教自己配置VS code 自定义快捷模块【不要看向我,用了一段时间现在才学,太渣了】

    打开vscode编辑器

    第一部分:自定义快捷模块操作

    1.打开命令面板

    快捷键  ctrl+shift+p

     

    2.输入snippets 搜索

     

    回车选中

              定义代码段名称【tem】

                 

         回车会打开一个文件,该文件就是用来存放自定义模块的代码【tem.code-snippets】

     第二部分:自定义快捷模块内容配置

    1.内容配置规则

    参数说明

    • prefix:使用代码段的快捷入口
    • body:需要设置的代码放在这里,字符串间换行的话使用 换行符隔开.如果值里包含特殊字符需要进行转义,多行代码以","分隔(在引号后面写逗号)
    • $0:定义最终光标位置
    • $1:定义第一次光标位置,按tab键可进行快速切换, 还可以有 $2$3$4$5 ...
    • description:代码段描述,在使用智能感知时的描述

    我这边自己定义一个vue模块 代码如下

     1  // 自定义(vue页面结构)
     2  {
     3      "vue": {
     4     "prefix": "vue-tem", // 设置的快捷入口
     5     "body": [ // 模块内容
     6         "<!-- $1 -->", // 光标
     7         "<template>",
     8         "  <div>",
     9         "     $2",
    10         "  </div>",
    11         "</template>",
    12         "",
    13         "<script>",
    14         "  export default {",
    15         "    name: '',",
    16       "    components: {",
    17       "         ",
    18       "    },",
    19       "    props: {",
    20       "       ",
    21       "    },",
    22       "    data() {",
    23       "      return {",
    24       "          ",
    25       "      }",
    26       "    },",
    27       "    computed: {",
    28       "        ",
    29       "    },",
    30       "    created() {",
    31       "        ",
    32         "    },",
    33       "    methods: {",
    34       "        ",
    35         "    },",
    36         "    watch: {",
    37         "       ",
    38         "    },",
    39         "  }",
    40             "</script>",
    41             "",
    42             "<style scoped lang=''>",
    43             "    ",
    44             "</style>"
    45     ],
    46     "description": "Vue templet" // 说明
    47  }
    48 }

    然后打开任意一个空白vue文件,输入vue-tem,回车直接生成自定义body内的代码,不重复贴出来了。【懒~】【到这步肯定知道咋操作了】

     

    参考链接 https://www.cnblogs.com/shenxianhui/p/9361957.html

     第三部: 定义已有的文件

    让我们把时间线回到第一步,输入snippets时,不要定义文件,直接输入vue(html ,JavaScript等也可以)

    打开vue.json 文件(我是直接默认这个了)

    定义模块内容,这里定义了console【原模板已有,放开注释即可 = . =】

    {
        // 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"
        },
    }
  • 相关阅读:
    (转载)C++ string中find() ,rfind() 等函数 用法总结及示例
    UVA 230 Borrowers (STL 行读入的处理 重载小于号)
    UVA 12100 打印队列(STL deque)
    uva 12096 The SetStack Computer(STL set的各种库函数 交集 并集 插入迭代器)
    uva 1592 Database (STL)
    HDU 1087 Super Jumping! Jumping! Jumping!
    hdu 1176 免费馅饼
    HDU 1003 Max Sum
    转战HDU
    hust 1227 Join Together
  • 原文地址:https://www.cnblogs.com/yflbk-2016/p/12765896.html
Copyright © 2020-2023  润新知