web建站教程
  1. 首页
  2. vuejs
  3. js
  4. 好玩
  5. AIGC工具
  6. 前端知识
  7. 百度echarts
  8. 更多
    php入门
    nodejs
    mockjs
    reactjs
    mysql
    wordpress
    织梦cms
    帝国cms
    git教程
    IT知识
    模板大全
    休息站
    手机应用

el-table 单项type="selection"出现数据错乱解决

1381 ℃

原先用的是@selection-change="selectionLineChangeHandle",发现会出现数据错乱,选中下一条获取的数据还是上一条。解决方法如下:

template代码

//把下面语句
el-table @selection-change="selectionLineChangeHandle" ref="table"
//改成
el-table @select="(selection, row) => {selectionLineChangeHandle(selection, row);}" ref="table"

js代码

//选中事件
selectionLineChangeHandle(selection, val) {
  // 单选
  this.dataonLineListSelections = [];
  if (selection.length > 1) {
	this.$refs.table.clearSelection();
	this.$refs.table.toggleRowSelection(selection.pop());
  }
  if (selection.length > 0) {
	this.dataonLineListSelections.push(val);
  }
}

在列表接口中清空dataonLineListSelections

el-table合并行的通用方法(附js代码)

el-table利用:row-style="rowClass"设置指定行变色

el-table表格显示selection多选时对某些复选框设置禁止选中

el-table表格实现多选功能(全选/指定选中/取消选中)

el-table实现拖拽行排序sortablejs

标签: el-table, selection, 代码错乱

上面是“el-table 单项type="selection"出现数据错乱解决”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://ipkd.cn/webs_1979.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

当前位置: 网站首页 > vuejs
本文共计554个字,预计阅读时长4分钟

基金从业资格考试题库

一站式备考基金从业资格考试,收录2021-2025年模拟题库!呱呱工具箱

AI工作站

收录全球3800+ 款各行各业AI应用,轻轻松松做事!
生活小工具,收录了80多款小工具
上一篇: 推荐一款简单高效漂亮的多平台笔记应用——Zoho Notebook
下一篇: 推荐2款充满科技感的艺术字体——小新黑体、小新潮酷体
x 打工人ai神器