vetur插件:vscode格式化html标签属性不换行

1. 点击左下角设置按钮,选择Settings

在这里插入图片描述

2.在用户设置下找到vetur,点击 Edit in settings.json

在这里插入图片描述

3.设置如下配置

{
    
    
    "[vue]": {
    
    
        "editor.defaultFormatter": "octref.vetur"
    },
    
    "vetur.format.defaultFormatter.html": "js-beautify-html", // html不换行,格式化模板选择为:js-beautify-html
    "vetur.format.defaultFormatterOptions": {
    
    

        "js-beautify-html": {
    
    
            "wrap_attributes": "auto",// html 标签属性 换行设置[auto|force|force-aligned|force-expand-multiline] ["auto"]
            "end_with_newline": false // 在文件结尾添加新行
        },
        "prettyhtml": {
    
    
            "printWidth": 100,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "vetur.grammar.customBlocks": {
    
    
    
        "docs": "md",
        "i18n": "json"
    }
}

猜你喜欢

转载自blog.csdn.net/weixin_43361722/article/details/113599666
今日推荐