vscode settings save automatically format vue code

1. Cancel automatic saving and set manual saving

ctrl+s

Insert image description here

2. Save with automatic formatting and automatic correction

Based on the vscode plug-in ESLint highlights errors and automatically helps us fix them through configuration.
Insert image description here

Open the settings page, click this to manually edit the settings, open setting.json, and add the following code

    // 当保存的时候,eslint自动帮我们修复错误
    "editor.codeActionsOnSave": {
        "source.fixAll": true
    },
    // 保存代码,不自动格式化
    "editor.formatOnSave": false

Insert image description here
Insert image description here
3. Demo
Not saved, not formatted
Insert image description here
Saved, automatically formatted
Insert image description here

Guess you like

Origin blog.csdn.net/Ying_ph/article/details/134666849