vscode 代码段 配置代码片段 snippets


如何在 vscode 配置代码片段?

ctrl + shift + p 命令面板,输入 user,找到 user snippets,选择 new global snippets file,输入名称,开始编写。
{
    "Print to console": {
        "prefix": "log",
        "body": [
            "console.log('$1');"
        ],
        "description": "Log output to console"
    },
    "Vue模板": {
        "prefix": "vue-template vue.init",
        "body": [
          "\n",
          "\n",
          "",
          "$0"
        ],
        "description": "Vue模板"
      }
}

相关