amis
amis copied to clipboard
如何通过按钮单独设置combo中某个item中的字段值?
1.2.2版本中,如何通过按钮单独设置combo中某个item中的字段值?请指教
没有懂你的意思
因为combo是一个对象数组,如果需要设置值,现在只能给combo的name字段设置为一个对象数组的值,无法单个设置,比如我想设置combo中第二个item中的某个字段值其他不变,不知道怎么设置,我尝试使用target来做,但不成功
你说的是这样么
不知道你是不是这个意思
@tangjion
所以没有后续了》????????????????????
你可以通过指定索引来控制更新哪条数据,通过index来指定,例如:
{
"type": "page",
"body": [
{
"type": "button",
"label": "更新数据",
"onEvent": {
"click": {
"actions": [
{
"componentId": "combo01",
"args": {
"value": {
"age": 18,
"name": "amis"
},
"index": 1
},
"actionType": "setValue"
}
],
"weight": 0
}
}
},
{
"type": "form",
"debug": true,
"api": "/api/mock2/form/saveForm",
"body": [
{
"type": "combo",
"name": "user",
"label": "用户",
"items": [
{
"name": "name",
"label": "名字",
"type": "input-text"
},
{
"name": "age",
"label": "年龄",
"type": "input-text"
}
],
"id": "combo01",
"multiLine": false,
"multiple": true,
"joinValues": true
}
],
"id": "u:43ef458d9691"
}
],
"id": "u:40855666ec27"
}