- 在vscode中先安装
vetur
、eslint
插件 - vscode
settings
中配置代码如下:
{
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "html",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
}
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}