我爱吃西瓜喵 2021-03-01 11:12 采纳率: 33.3%
浏览 45
已结题

这种代码如何优化,不想要这么多变量,但是每个变量都会用到

getTableData(row) {
      this.name = row.name;
      this.sex = row.sex;
      this.person = row.person;
      this.age = row.age;
      this.type = row.type;
      this.status = row.status;
      this.like = row.like;
      this.date = row.date;
      this.children = row.children;
      this.dress = row.dress;

}

  • 写回答

1条回答 默认 最新

  • 斯洛文尼亚旅游 2021-03-01 11:24
    关注

    这种写法你必须知道row对象的属性

    getTableData(row) {
    
    this.row=row;
    
    }
    
    
    
    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 9月13日