picker设置了默认值时的bug
- Dominant language
- TypeScript
- Stars
- 18.9k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
amis 6.10.0
编辑设备按钮,点击弹出“编辑设备”对话框,对话框中放一个form表单,form表单中放一个picker(用于选择已有的设备组,source配置为接口,分页拉取设备组)
```json
{
"type": "page",
"id": "u:35f5d256a94d",
"asideResizor": false,
"pullRefresh": {
"disabled": true
},
"regions": [
"body"
],
"body": [
{
"type": "button",
"label": "编辑",
"onEvent": {
"click": {
"actions": [
{
"ignoreError": false,
"actionType": "dialog",
"dialog": {
"type": "dialog",
"title": "编辑设备",
"body": [
{
"id": "u:a0b36d55d540",
"type": "form",
"title": "表单",
"mode": "flex",
"labelAlign": "left",
"dsType": "api",
"feat": "Edit",
"body": [
{
"type": "picker",
"label": "设备组",
"name": "group_id",
"overflowConfig": {
"maxTagCount": -1
},
"modalClassName": "app-popover :AMISCSSWrapper",
"id": "u:f831f83ee73b",
"multiple": false,
"value": "${\"abc\"}",
"source": {
"method": "post",
"url": "http://localhost:8000/api/v1/devices/group/list?page=${page}&size=${perPage}",
"requestAdaptor": "",
"adaptor": "",
"messages": {},
"dataType": "json"
},
"labelField": "name",
"valueField": "id"
}
],
"api": {
"url": "http://localhost:8000//api/v1/devices/update/1",
"method": "get"
},
"actions": [
{
"type": "button",
"label": "提交",
"onEvent": {
"click": {
"actions": [
{
"actionType": "submit",
"componentId": "u:a0b36d55d540"
}
]
}
},
"level": "primary"
}
],
"resetAfterSubmit": true,
"initApi": ""
}
],
"id": "u:7795f12070d5",
"actions": [
{
"type": "button",
"actionType": "cancel",
"label": "取消",
"id": "u:5080f7523d0a"
},
{
"type": "button",
"actionType": "confirm",
"label": "确定",
"primary": true,
"id": "u:392fc5786caa"
}
],
"showCloseButton": true,
"closeOnOutside": false,
"closeOnEsc": false,
"showErrorMsg": true,
"showLoading": true,
"draggable": false,
"actionType": "dialog"
}
}
]
}
},
"id": "u:cdf66fba427e"
}
],
"definitions": {}
}
```
问题:当picker的value有值时,点击编辑按钮打开对话框时,会执行picker配置的source分页拉取接口,但是传给接口的page、perPage为空。当picker的value未设置时,点击编辑按钮打开对话框时,不会执行picker配置的source分页拉取接口。
期望:不管picker的value有没有值,点击编辑按钮打开对话框时,都不需要执行picker配置的source分页拉取接口。
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the provided dialog and picker configuration in amis 6.10.0, then trace the picker source-loading path when it has a default value and when it does not. Verify the request parameters in both cases; done means opening the dialog does not call the picker source pagination API regardless of whether value is set.
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