tdesign-react icon indicating copy to clipboard operation
tdesign-react copied to clipboard

[Select] keys中label不能为content

Open langziyang opened this issue 1 year ago • 2 comments

tdesign-react 版本

1.7.6

重现链接

No response

重现步骤

<Select
                    options={hints.filter(item => item.type === 'accept')}
                    valueType='object'
                    keys={{value: '@id', label: 'content'}}
                />

期望结果

当 keys={{value: '@id', label: 'content'}}中label为content时不能选择

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

langziyang avatar Jul 08 '24 06:07 langziyang

👋 @langziyang,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

github-actions[bot] avatar Jul 08 '24 06:07 github-actions[bot]

可以的话提供个例子

HaixingOoO avatar Jul 08 '24 11:07 HaixingOoO

复现 DEMO
import React, { useState } from 'react';
import { Select } from 'tdesign-react';

const hints = [
  { '@id': 1, content: '内容A', type: 'accept' },
  { '@id': 2, content: '内容B', type: 'accept' },
  { '@id': 3, content: '内容C', type: 'reject' },
];

export default function ObjectValueSelect() {
  const [value, setValue] = useState(null);

  return (
    <Select
      style={{ width: '1000px' }}
      options={hints}
      value={value}
      onChange={setValue}
      valueType="object"
      keys={{ value: '@id', label: 'content' }}
    />
  );
}

因为字段冲突了...content 对应 API 文档上写的的含义,理论上除了 content,如果想要将 label 映射为下面的任何一种,都会失败 🤔

RylanBot avatar Sep 16 '25 19:09 RylanBot

已修复,并发布 1.15.2 版本

RylanBot avatar Sep 29 '25 08:09 RylanBot