tdesign-react
tdesign-react copied to clipboard
[Select] keys中label不能为content
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,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。
可以的话提供个例子
复现 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 映射为下面的任何一种,都会失败 🤔
已修复,并发布 1.15.2 版本