最近在用Hbuilder-X,自带js-beautify。但是默认格式化设置实在是看着太难受。来看看一个VX的格式化,参数愣是给用了三行才格式化完,而且两个参数还分开了,看着太难受。

// mutations
const mutations = {
    setProducts(state, { 
        defects 
        }) {
        console.log("mutations.setProducts", defects)
        state.all = defects
    }
}

 

让我们来美化一下,是不是看着很舒服了。

const mutations = {
    setProducts(state, { defects }) {
        console.log("mutations.setProducts", defects)
        state.all = defects
    }
}

 

具体配置就是打开js-beautify的配置文件,修改两个配置就可以了

 "brace_style": "collapse-preserve-inline", //代码样式,可选值 [collapse|expand|end-expand|none][,preserve-inline] [collapse,preserve-inline
"wrap_line_length": 12000, //根据需要设置换行长度

 

相关文章:

  • 2021-09-12
  • 2022-12-23
  • 2021-11-17
  • 2021-08-19
  • 2021-07-09
  • 2021-12-11
  • 2022-12-23
  • 2021-09-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-15
  • 2022-12-23
  • 2021-12-16
  • 2021-07-23
  • 2022-12-23
相关资源
相似解决方案