把这个事件合成一个 Edats() { this.dataSource.forEach((item) => { let editItem = cloneDeep(item) this.$set(this.editableData, item.key, editItem) }) this.dataSourceFeWate.forEach((item) => { let editItem = cloneDeep(item) this.$set(this.editableDataFeWate, item.key, editItem) }) this.conceal = true this.concealFeWater = true },
时间: 2024-03-08 15:48:57 浏览: 107
canal.adapter 运行异常: com.alibaba.druid.pool.DruidDataSource 解决办法
可以将这个事件重构为一个更通用的方法,如下所示:
```
editData(dataSource, editableData, conceal, dataSourceFeWate, editableDataFeWate, concealFeWater) {
dataSource.forEach((item) => {
let editItem = cloneDeep(item)
this.$set(editableData, item.key, editItem)
})
dataSourceFeWate.forEach((item) => {
let editItem = cloneDeep(item)
this.$set(editableDataFeWate, item.key, editItem)
})
conceal = true
concealFeWater = true
}
```
然后在需要调用的地方传入相应的参数即可:
```
this.editData(this.dataSource, this.editableData, this.conceal, this.dataSourceFeWate, this.editableDataFeWate, this.concealFeWater)
```
阅读全文