使用vxe-grid获取被选中一行的内容

方法如下

const $grid = xGrid.value;

const selectRecords = $grid?.getCheckboxRecords(true)

这里的getCheckboxRecords()用于 type=checkbox的行,获取当前已选中的行数据,参数为true 则获取全表已选中的数据。

它获取到的数据是这样的:

 上图是选中两行时获取到的数据,这是一个长度为2的对象数组。

因此,可以使用selectRecords[0].id获取具体的数据项(例如id)。

参考官网:vxe-table v4

猜你喜欢

转载自blog.csdn.net/defined_/article/details/130134415
今日推荐