baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.42k stars 2.52k forks source link

fix: 修复combo内select的options使用valueField时options会被全部禁用的问题 #10957

Closed CheshireJCat closed 2 months ago

CheshireJCat commented 2 months ago

What

{
  "type": "page",
  "body": {
    "type": "combo",
    "name": "combo2",
    "label": "Combo 多选展示",
    "multiple": true,
    "items": [
      {
        "name": "text",
        "label": "文本",
        "type": "input-text"
      },
      {
        "name": "select",
        "label": "选项",
        "type": "select",
        "unique": true,
        "labelField": "name",
        "valueField": "id",
        "options": [
          {
            "name": "选项1",
            "id": 1
          },
          {
            "name": "选项2",
            "id": 2
          },
          {
            "name": "选项3",
            "id": 3
          },
        ]
      }
    ]
  }
}

以上schema选择一项后,其他select的options会被全部禁用

Why

syncOptions中,使用 valueField 时,item.value 取不到值,导致了异常

How

item.value -> item[valueField]
github-actions[bot] commented 2 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.