当前位置:网站首页>ant desgin 多选

ant desgin 多选

2022-07-07 17:22:00 tonysh_zds

clickThenSelect(record) {
        return {
          on: {
            click: () => { 
                let rowKeys=this.selectedRowKeys
                let rows =  this.selectionRows
                if(rowKeys.length>0 && rowKeys.includes(record.id)){
                    rowKeys.splice(rowKeys.indexOf(record.id),1)
                    rows.splice((record),1)
                }else{
                    rowKeys.push(record.id)
                    rows.push(record)
                }

                this.onSelectChange(rowKeys,rows);
            },
            dblclick: () => {
              this.handleDetail(record)
            }
          }
        }
      },
      ```
      单选
      ```
      clickThenSelect(record) {
                return {
                    on: {
                        click: () => {
                            this.onSelectChange(record.id.split(","), [record]);
                        },
                        dblclick: () => {
                            this.handleDetail(record)
                        }
                    }
                }
            },
            ```
原网站

版权声明
本文为[tonysh_zds]所创,转载请带上原文链接,感谢
https://blog.csdn.net/tonysh_zds/article/details/125563932