alert0822
alert0822
  • 发布:2018-06-19 15:06
  • 更新:2022-03-08 09:55
  • 阅读:5472

【报Bug】hbuilder X对vue文件重排代码格式的问题

分类:HBuilder
Vue

详细问题描述
[内容]
在编写完vue文件之后,让格式更加清晰,会右键点击 ' 重排代码格式 ctrl+k ',但是会出现vue代码混乱现象

重现步骤
[步骤]
右键点击 ' 重排代码格式 ctrl+k ',

[结果]
vue代码混乱 (附件1)
[期望]
vue代码格式清晰(附件2)

运行环境
win10

[IDE版本]
0.1.41.20180612-alpha

2018-06-19 15:06 负责人:无 分享
已邀请:
alert0822

alert0822 (作者)

已找到解决方法 http://ask.dcloud.net.cn/question/55284

2***@qq.com

2***@qq.com

**通过查看官方手册:https://github.com/HookyQR/VSCodeBeautify/blob/master/Settings.md

修改jsbeautifyrc.js文件

只需要修改的地方如下:**

"html": {    
    "indent_handlebars": true,    
    "indent_inner_html": true,    
    "indent-scripts": "normal", //[keep|separate|normal]    
    "extra_liners": [], //配置标签列表,需要在这些标签前面额外加一空白行    
    // 查看手册:https://github.com/HookyQR/VSCodeBeautify/blob/master/Settings.md    
    "indent_scripts": "separate", // "keep", "separate" 这个不会加空格, or "normal"    
    "js": {    
        // 在命名函数的括号之前添加一个空格,即。function example ()。    
        "space_after_named_function": true,    
        // 在匿名函数的括号之前添加一个空格,即。function ()    
        "space_after_anon_function": true    
    }    
}    

这样就可以直接快捷键格式化代码,不需要修改eslint配置文件了,可以直接复制替换自己jsbeautifyrc.js文件中 这个html的代码格式配置

该问题目前已经被锁定, 无法添加新回复