在setting.json中加入如下内容
{
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
]
}
参考:http://www.ptbird.cn/vscode-autosave-eslint-support-vue.html