<el-form-item class="inputOne">
<el-button
type="success"
size="small"
icon="el-icon-search"
@click="getManufacturerData(props.row)"
>查询</el-button>
</el-form-item>
props.row: 代表这一行数据的数组
getManufacturerData(row) {
this.manufacturerVisible = true
this.rowArray = row
getSuppliers(
Object.assign(
{
current: this.pageIndex3,
size: this.pageSize3,
},
this.manufacturerForm
)
).then(res => {
console.log(444,res)
this.manufacturerData = res.data.data.records
this.totalPage3 = res.data.data.total
})
},
// 每页数
sizeChange3(val) {
this.pageSize3 = val
this.pageIndex3 = 1
this.getManufacturerData()
},
// 当前页
currentChange3(val) {
this.pageIndex3 = val
this.getManufacturerData()
},
rowClick1(row) {
this.rowArray.manufacturer = row.company
this.rowArray.manufacturerDescription = row.name
this.manufacturerVisible = false
},
这里我们用到的定义就是:数组赋值其实是将一个数组的地址赋值给另一个数组,rowArray 和 row两个数组保存的都是数组地址,均可对该地址的数组数据进行操作(增删改查)。
rowArray = row:就是巧用这个定义;相当于浅拷贝