el-table implementiert check echo

Hinweis: Legen Sie das Attribut row-key="id" für el-table fest und binden Sie die eindeutige Attribut-ID. Und fügen Sie das Attribut :reserve-selection="true" in der Kontrollkästchenspalte hinzu.

//设置这一行选中与否
let list=[{
    
    id:111,name:'张三'}]
if (list.length > 0) {
    
    
   list.forEach(row => {
    
    
     this.$nextTick(() => {
    
    
      this.$refs.table.toggleRowSelection(row, true);
    })
  });
}
//清空用户的选择
this.$refs.table.clearSelection();

Supongo que te gusta

Origin blog.csdn.net/weixin_46054723/article/details/130111949
Recomendado
Clasificación