a-table中getCheckboxProps的使用实现禁用表格中指定条目不可选

发布时间 2023-08-10 16:38:36作者: Felix_Openmind

示例

code

                    <a-table
                            style="height: 520px"
                            size="small"
                            :row-selection="{
                                getCheckboxProps: getCheckboxProps,
                                onChange: onSelectChange,
                                selectedRowKeys: state.selectedRowKeys,
                            }"
                            v-if="state.activeKey === tab.key"
                            :loading="state.tableLoading"
                            :rowKey="(record) => record.id"
                            :columns="tab.cols"
                            :dataSource="tab.tableData"
                            :scroll="{ x: 1500, y: 500 }"
                            :pagination="pagination"
                    >

const getCheckboxProps =  (record) => ({
    disabled: record.shoppingFlag, // Column configuration not to be checked
})