九镑十七便士 2023-07-31 09:41 采纳率: 30.6%
浏览 13

请问下列javascript要怎么优化


showCollapses() {
      const { formData } = this;
      let collapseList = formData.unionTransferee ? this.restructureConfig(this.showCollapse, {
        slot: 'joint-assignee-info',
        anchor: 'jointAssigneeInfo',
        title: this.isCapitalIncrease ? '联合投资体信息' : '联合受让体信息'
      }, 3) : this.showCollapse;
      collapseList = formData.entrust ? this.restructureConfig(collapseList, {
        slot: 'member-information',
        anchor: 'memberInformation',
        title: '会员信息'
      }, -2) : collapseList;
      return collapseList;
    }
  • 写回答

6条回答 默认 最新

  • 一只成序源 2023-07-31 09:56
    关注

    这样写代码挺好的,除了人看不太明白以外,优化的话改成if罗,看起来逻辑清晰一点,其实也差不多

    评论

报告相同问题?

问题事件

  • 创建了问题 7月31日