vscode


快捷键

  • 整理代码快捷键
    • win: Shift +Alt+F
    • Mac: Shift + Option + F

插件:

  • Live Server-开启一个服务器
  • beautify 格式化代码的插件

添加代码片段

  • 点击【文件】---【首选项】---【用户代码片段】--【vue】
  • 修改vue.json
{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "\n",
            "\n",
            "\n",
        ],
        "description": "Create vue template"
    }
}
  • 使用: vue+回车

格式化时标签的属性会换行解决方法

  • setting.json
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "emmet.includeLanguages": {
        "wxml": "html"
    },
    "minapp-vscode.disableAutoConfig": true,
    "explorer.confirmDelete": false,
    "vetur.format.options.tabSize": 4,
    "vetur.format.defaultFormatterOptions":{
        "js-beautify-html":{
            "wrap_attributes":"auto"
        }
    },
    "vetur.format.defaultFormatter.js": "vscode-typescript",

其他配置:

  • 自动换行
    "editor.wordWrap": "on"