1、打开vscode 2、使用Ctrl+shift+p打开命令面板,输入settings打开设置,然后输入"editor.codeActionsOnSave": { “source.fixAll.eslint”: true },保存 亲测有效