<el-table
:data="dataList.data"
style="width: 100%"
stripe border
:key="key"
v-loading="loading"
:max-height="550"
>
<el-table-column
prop="id"
label="ID"
align="center"
width="60"
></el-table-column>
<el-table-column label="人才姓名" align="center">
<template slot-scope="scope">
{{ scope.row.person_name }}
</template>
</el-table-column>
<el-table-column label="证书类别" align="center" >
<template slot-scope="scope">
{{ scope.row.certificate_type_val }}
</template>
</el-table-column>
<el-table-column label="证书专业" align="center" >
<template slot-scope="scope">
{{ scope.row.certificate_professional_val }}
</template>
</el-table-column>
<el-table-column label="收价(元)" align="center" >
<template slot-scope="scope">
{{ scope.row.purchase_price }}
</template>
</el-table-column>
<el-table-column label="出价(元)" align="center" >
<template slot-scope="scope">
{{ scope.row.offer_price }}
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
fixed="right"
width="150"
:max-height="480"
>
<template slot-scope="scope">
<div>
<el-button
size="mini"
type="success"
title="减少"
@click.native.prevent="reduce(scope.row,scope.$index)"
>减少
</el-button>
<el-button
size="mini"
type="primary"
title="置换"
@click="replacement(scope.row,scope.$index)"
>置换
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<script>
export default {
data(){
return{
dataList:{
data:[]
}
}
},
methods:{
// 减少
reduce(data,index){
setTimeout(()=>{
this.dataList.data.splice(index,1)
// this.dataList = this.dataList.data.splice(index,1) 错误的数据,返回的是删除的数据,而不是删除过后的数据
})
},
replacement(data,index){
setTimeout(()=>{
this.dataList.data.splice(index,1)
})
}
}
}
</script>
el-table 删除行数据(犯错篇)
最新推荐文章于 2024-11-10 09:00:00 发布