当前位置:网站首页>vxe-table 从页面批量删除数据 (不动数据库里的数据)
vxe-table 从页面批量删除数据 (不动数据库里的数据)
2022-08-04 00:36:00 【paradoxaaa_】
<vxe-table v-if="options"
ref="vxeTable"
border
:column-config="{resizable: true}"
:row-config="{isCurrent: true, isHover: true,keyField:'id'}"
:checkbox-config="{range: true,reserve: true,trigger: 'row'}"
@checkbox-all="selectAllEvent"
@checkbox-change="selectChangeEvent"
v-loading="options.loading"
>
<vxe-table-column type="checkbox" width="38"></vxe-table-column>
</vxe-table>
<div class="btn-del">
<vxe-button status="primary" @click="markedDelHandle"
:disabled="disableHandle">Marked Del</vxe-button>
<vxe-button @click="UnMarkedDelHandle" :disabled="disableHandle">UnMarkedDelHandle</vxe-button>
</div>思路:先将选中数据保存在新数组arr中 然后定义一个空数组datas,遍历表格所有数据(这里是options.data) 如果不存在选定的数组arr 就把表格其他数据添加到空数组datas中 然后页面只显示新的datas。
// 全选
selectAllEvent ({ checked, records}) {
this.filterData = records;
this.checkedList= records;
// 无选中数据时禁用按钮
if (records && records.length) {
this.disableHandle = false;
} else{
this.disableHandle = true;
}
console.log(checked ? '所有勾选事件' : '所有取消事件', records)
this.$emit("checkChanged", records);
},
// 复选
selectChangeEvent ({ checked, records }) {
this.filterData = records;
this.checkedList= records;
if (records && records.length) {
this.disableHandle = false;
} else{
this.disableHandle = true;
}
console.log(checked ? '勾选事件' : '取消事件', records)
this.$emit("checkChanged", records);
},
// 删除选中行数据
markedDelHandle (){
let arr=this.checkedList; //选中的数据
let datas = [];
this.options.data.forEach((item)=>{
if(arr.indexOf(item) === -1 ){
datas.push(item)
}
})
this.options.data = datas
},
// 保留选中行数据
UnMarkedDelHandle (){
this.options.data = this.checkedList
},
边栏推荐
猜你喜欢

分布式事务框架 seata

Spinnaker调用Jenkins API 返回403错误

jmeter跨平台运行csv等文件

Tanabata festival coming, VR panoramic look god assists for you

电子制造企业部署WMS仓储管理系统的好处是什么

ENS域名注册量创历史新高 逆市增长之势?光环之下存在炒作风险

c语言分层理解(c语言指针(上))

Getting started with MATLAB 3D drawing command plot3

ML18-自然语言处理

After building the pytorch environment, the pip and conda commands cannot be used
随机推荐
ENS域名注册量创历史新高 逆市增长之势?光环之下存在炒作风险
Justin Sun: Web3.0 and the Metaverse will assist mankind to enter the online world more comprehensively
2023年航空航天、机械与机电工程国际会议(CAMME 2023)
浅谈我国产业园区未来的发展方向
jmeter distributed stress test
BGP实验(含MPLS)
C# wpf使用ffmpeg命令行实现录屏
【超详细教程】LVS+KeepAlived高可用部署实战应用
LYVE1抗体丨Relia Tech LYVE1抗体解决方案
MPLS Comprehensive Experiment
【链路聚合原理及配置】
ping数据包中的进程号
Node.js的基本使用(三)数据库与身份认证
The problem of disorganized data output by mnn model
C # WPF equipment monitoring software (classic) - the next
如何通过单步调试的方式找到引起 Fiori Launchpad 路由错误的原因试读版
孙宇晨:Web3.0和元宇宙将协助人类更加全面地进入网络世界
Nanoprobes Alexa Fluor 488 FluoroNanogold 偶联物
因为一次bug的教训,我决定手撕Nacos源码(先撕客户端源码)
Jmeter cross-platform operation CSV files