ant-design / ant-design/pro-components
🐛[BUG] ProFormSelect 在设置labelInValue为true,且设置mode为tags时,存在有value与label的option,然后再手动输入的value。之后获取values的时候,只有value没有lable属性了。
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🐛 bug 描述
ProFormSelect 在设置labelInValue为true,且设置mode为tags时,存在有value与label的option,然后再手动输入的value。之后获取values的时候,只有value没有lable属性了。
### 📷 复现步骤
先给ProFormSelect 初始化一个值{label,value},然后再输入添加一个新的值,这个时候获取就出现上述问题。
### 🏞 期望结果
在设置labelInValue为true,以后无论是初始化给的值,还是手动输入的值,应该都返回label与value。
### 💻 复现代码
```
import React from "react";
import {ProForm} from "@ant-design/pro-form";
import {ProFormSelect} from "@ant-design/pro-components";
import {Button} from "antd";
const Test = () => {
const [form] = ProForm.useForm();
const [result, setResult] = React.useState("");
const handleSetValues = () => {
form.setFieldsValue({
name: [
{label: "123", value: "123"},
],
});
}
return (
Test
set values
{
setResult(JSON.stringify(values));
}}
>
);
};
export default Test;
```
### © 版本信息
- ProComponents 版本: 2.7.0
- umi 版本 @umijs/max": "^4.0.90
- 浏览器环境 Chrome 123
- 开发环境 vscode
### 🚑 其他信息

这个问题还很奇怪,两个截图中,第一个截图的三个值都是输入的值,获取的结果没有label,当我删除一条再获取的时候就存在了label值
Contributor guide
Research direction
Start by reproducing the provided example with ProFormSelect using labelInValue and tags, then inspect the ProFormSelect entry point and its fieldProps handling. Done means both initialized and manually entered values retain label and value, with a regression test covering the reported sequence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100