select组件使用遇到问题
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
#### 描述问题:
当value值包含 ,@ 字段,就会导致选择的数据有问题。也会导致autofill出现问题。
```json
{
"type": "select",
"label": "autoFill触发器",
"name": "select",
"autoFill": {
"option.instantValidate": "${value}",
"option.submitValidate": "${value}"
},
"clearable": true,
"options": [
{
"label": "Option A",
"value": "aaaaa,@dsakldjsal"
},
{
"label": "Option B",
"value": "b"
}
]
}
```
如:正常情况下,选择"Option A",会显示选择了"Option A",但是如果值中有,@字符,选择了"Option A"后,会显示value,还显示不全,其中如果使用了autoFill属性,,@ 字符后面的字符也会丢失
#### 截图或视频:

#### 如何复现(请务必完整填写下面内容):
1. 你是如何使用 amis 的?
`sdk`、`npm` 或`其他`...
2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
3. 粘贴有问题的完整 `amis schema` 代码:
```json
{
"type": "page",
"body": {
"type": "form",
"api": "/amis/api/mock2/form/saveForm",
"debug": true,
"debugConfig": {
"levelExpand": 2
},
"body": [
{
"type": "select",
"label": "autoFill触发器",
"name": "select",
"autoFill": {
"option.instantValidate": "${value}",
"option.submitValidate": "${value}"
},
"clearable": true,
"options": [
{
"label": "Option A",
"value": "aaaaa,@dsakldjsal"
},
{
"label": "Option B",
"value": "b"
}
]
},
{
"type": "input-text",
"name": "option.instantValidate",
"label": "目标1",
"description": "填充后立即校验",
"required": true,
"validateOnChange": true,
"validations": {
"equals": "Option B"
},
"validationErrors": {
"equals": "校验失败,数据必须为Option B"
}
},
{
"type": "input-text",
"name": "option.submitValidate",
"label": "目标2",
"description": "填充后提交表单时才校验",
"required": true,
"validations": {
"equals": "Option B"
},
"validationErrors": {
"equals": "校验失败,数据必须为Option B"
}
},
{
"type": "input-text",
"name": "option.c",
"label": "表单项3",
"description": "不受autoFill影响的表单项",
"value": "abc"
}
]
}
}
```
4. 操作步骤
请简单描述一下复现的操作步骤...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the complete AMIS schema in the issue and reproduce the select component using an option value containing `,@`, both with and without autoFill. Trace how the select value and autoFill substitutions are parsed, then add coverage confirming the displayed selection and autofilled fields retain the full text after `,@`.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100