el-table怎么获取单选选中的行数据?
方法
1、el-table中添加ref=“singleTableRef”
<el-table ref="singleTableRef"></el-table>
const singleTableRef= ref<InstanceType<typeof ElTable>>();
const getSelectRow=()=>{
let row = singleTableRef.value.store.states.currentRow.value;
if (row==null) {
toast("没有选中行", "warning");
return;
}
return row;
}