vue table中點選一個按鈕之後這個按鈕隱藏讓下一個按鈕顯示
阿新 • • 發佈:2020-12-24
在獲取後臺返回得列表時。拿到陣列去迴圈他,
利用this.$set 給陣列的每一個物件新增屬性
for (let i = 0; i < data.data.data.records.length; i++) {
this.$set(data.data.data.records[i],'sex','true')
}
使用 v-if v-else去判斷顯示隱藏
<template slot-scope="scope">
<el-button type="primary" size="small" v-if="scope.row.sex" @click="handleDown(scope.$index,scope.row)">下載</el-button>
<el-button type="primary" size="small" v-else @click="btn()" >稽核</el-button>
</template>
在點選事件中去改變增加屬性的值
handleDown(index,row){
this .dataList[index].sex = false
},