Skip to content

BasicTable在使用clickToRowSelect=true的状态下,selection-change 事件在每次选中项切换后会触发多次 #6408

@Randname666

Description

@Randname666
版本号:

3.6.2 (ffc79bc)

问题描述:

BasicTable在使用clickToRowSelect=true的状态下,selection-change 事件在每次选中项切换后会触发多次。设置clickToRowSelect=false,表现正常。

截图&代码:
<BasicTable @register="registerTable" :rowSelection="rowSelection" @selection-change="selectionChangeEvent">

(...)

</BasicTable>

<script lang="ts" name="ProjectInfo" setup>
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
    tableProps: {
      title: '主项目',
      api: queryIndex,
      rowKey: 'id',
      rowSelection: { type: 'radio' },
      columns,
      canResize: true,
      minHeight: 500,
      clickToRowSelect: true,
      formConfig: {
        schemas: searchFormSchema,
        autoSubmitOnEnter: true,
        showAdvancedButton: true,
        fieldMapToNumber: [],
        fieldMapToTime: [],
      },
      actionColumn: {
        width: 120,
        fixed: 'right',
      },
      beforeFetch: (params) => {
        params.isChildren = '0';
        return Object.assign(params, queryParam);
      },
    },
    exportConfig: {
      name: 'project_info',
      url: getExportUrl,
      params: queryParam,
    },
    importConfig: {
      url: getImportUrl,
      success: handleSuccess,
    },
  });

(...)

function selectionChangeEvent(sel) {
    console.log("event happening, timestamp:"+Number(new Date()));
  }
</script>

截屏2024-03-16 09 25 42
每次选中项切换,产生多次事件,但点击“清空”只产生一次事件。

友情提示(为了提高issue处理效率):

  • 未按格式要求发帖,会被直接删掉;
  • 请自己初判问题描述是否清楚,是否方便我们调查处理;
  • 描述过于简单或模糊,导致无法处理的,会被直接删掉;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions