Skip to content

table 组件 自定义表尾合并列功能控制台报错,TDesign Table Error: rowKey is wrong, can not get unique identifier of row. #6014

@elvisWEB

Description

@elvisWEB

tdesign-vue-next 版本

1.15.3

重现链接

https://tdesign.tencent.com/vue-next/components/table#%E8%87%AA%E5%AE%9A%E4%B9%89%E8%A1%A8%E5%B0%BE%E7%9A%84%E8%A1%A8%E6%A0%BC

重现步骤

  1. 先进入 页面, 然后先点击 通栏表尾,最后击 自定义表尾合并列,切勿直接点击 自定义表尾合并列(因为文档有bug,直接点击,表尾不会合并),
  2. 此时控制台就会提示错误:Design Table Error: rowKey is wrong, can not get unique identifier of row.
  3. 问题出现原因:
 // 组件标签设置
  :rowspan-and-colspan-in-footer="rowspanAndColspanInFooter

  // 对应函数
  const rowspanAndColspanInFooter: TableProps['rowspanAndColspanInFooter'] = ({ rowIndex, colIndex }) => {
    if (rowIndex === 0 && colIndex === 1)
      return {
       colspan: columns.length - 2, //  问题再这里, 只要设置了 colspan,控制台就会报错
    };
    return {};
  };

期望结果

不会报错

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions