ant-design-vue table表格条件判断是否可选中

357 阅读1分钟
          <a-table
                ref="table2"
                size="small"
                bordered
                rowKey="index"
                :columns="fpxxColumns"
                :dataSource="fpxxDataSource"
                :pagination="false"
                :rowSelection="rowSelection"
                @change="handleTableChange"
            >
            </a-table>
            
 computed:{
    rowSelection(){
        const _this=this;
        const {selectedRowKeys} = this
        return {
            selectedRowKeys,
            onChange:(selectedRowKeys) => {
                this.selectionRows = selectedRowKeys
            },
            getCheckboxProps:(record) => ({
                props: {

                    //全部默认禁止选中
                    disabled:true,
                    
                    //发票已存在不允许选中
                    disabled:record.state===1

                    //某几项默认选中(当state等于1时)
                    //defaultChecked:record.state==1
                }
            })
        }
    }
},