element表格多選刪除後怎麼清空勾選狀態

效果圖:
在這裏插入圖片描述
在這裏插入圖片描述

//記住勾選
getRowKey (row) {
    return row.id
 },
//刪除和清空表格勾選狀態
        delPurchase () {
            this.multipleSelection.forEach(item => {
                this.tableData3.forEach((item1, index) => {
                    if (item.id == item1.id) {
                        this.tableData3.splice(index, 1)
                        this.tableData4.forEach((item2, index) => {
                        //判斷刪除id是否等於傳遞過來的數據,是就將勾選狀態取消
                            if (item1.id == item2.id) {
                               this.$refs.multipleTable.toggleRowSelection(this.tableData4[index], false);
                            }
                        })                  
                    }
                })

            })
        },
//清空所有的勾選狀態
this.$refs.multipleTable.clearSelection()

//element的表格錯位
/deep/.el-table th.gutter {
    display: table-cell !important;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章