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

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

1038 ℃
     

原先用的是@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表格显示selection多选时对某些复选框设置禁止选中

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

el-table实现拖拽行排序sortablejs

el-dialog中获取el-table组件的ref值报undefined错误!

el-table列表给指定列的文字添加样式,但是列是动态的

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

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

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

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

当前位置: 网站首页 > vuejs
本文共计554个字,预计阅读时长4分钟
生活小工具,收录了80多款小工具
上一篇: 推荐一款可免费商用圆体字库——江城圆体
下一篇: 推荐一款由字制区设计团队的免费综艺字体——字制区喜脉体
x 打工人ai神器