<template>
	<a-table
        :columns="columns"
        :dataSource="data"
        rowKey="id"
        :loading="loading"
        :pagination="pagination"
        :rowSelection="rowSelection"
        >
      </a-table>
</template>
<script>
export default {
  computed: {
      rowSelection() {
        const _this = this
        const { selectedRowKeys } = this;
        return {
          selectedRowKeys,
          onChange: (selectedRowKeys) => {
            this.selectedRowKeys = selectedRowKeys;
            if (this.selectedRowKeys.length) {
              this.disabled = false;
            } else {
              this.disabled = true;
            }
          },
          getCheckboxProps: record => ({
            props: {
            // 全部默认禁止选中
              disabled: true,
           // 某几项默认禁止选中(R: 当state等于1时)
           // disabled: record.state == 1,
           // 某几项默认选中(R: 当state等于1时)
              defaultChecked: record.state == 1,
            },
          }),
        };
      },
  }
}
</script>
Logo

前往低代码交流专区

更多推荐