vbenjs / vben-admin-thin-next

vue-vben-admin-2.0 mini template.vue3,vite,typescript
https://vvbin.cn/thin/next
MIT License
2.06k stars 853 forks source link

[bug]-BasicTable中设置了某列为edit=true后,设置rowKey的值会导致内存泄漏 #30

Open Sara2009 opened 3 years ago

Sara2009 commented 3 years ago

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

Describe the bug

设置列属性名称为可编辑的,这个时候如果设置rowKey,会有bug

export function getBasicColumns(): BasicColumn[] {
  return [
    {
      title: 'ID',
      dataIndex: 'taskId',
      width: 200,
    },
    {
      title: '名称',
      dataIndex: 'taskName',
      edit: true,
      width: 200,
    },
    {
      title: '准确率',
      dataIndex: 'accuracy',
      width: 200,
    },
    {
      title: '开始时间',
      width: 300,
      dataIndex: 'startTs',
    },
    {
      title: '结束时间',
      width: 300,
      dataIndex: 'endTs',
    },
    {
      title: '状态',
      dataIndex: 'status',
    },
  ];
}

// setup
const [registerTable, { getSelectRowKeys, getSelectRows }] = useTable({
        title: '数据列表',
        columns: getBasicColumns(),
        bordered: true,
        dataSource: props.dataset,
        canResize: false,
        pagination: {
          total: props.total,
          defaultPageSize: props.pageSize,
        },
        showIndexColumn: false,
        rowKey: 'taskId',
        rowSelection: {
          type: 'checkbox',
        },
        actionColumn: {
          width: 250,
          title: '操作',
          dataIndex: 'action',
          slots: { customRender: 'action' },
        },
      });

image

Reproduction

Please describe the steps of the problem in detail to ensure that we can restore the correct problem

System Info