amis icon indicating copy to clipboard operation
amis copied to clipboard

Select控件下拉框大小配置不生效

Open wwsheng009 opened this issue 7 months ago • 0 comments

描述问题:

在使用select控件时,如果使用source api提供选项列表,overlay配置选项不生效。

截图或视频:

可以在以下地址找到可重复问题的代码与示例。 http://fun.wwsheng.xyz:5099/amis-editor/#/select

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

6.11.0,6.12都存在问题。

  1. 粘贴有问题的完整 amis schema 代码:

正确没有问题的代码,下拉框大小可以控制。

{
  "type": "page",
  "title": "select",
  "body": [
    {
      "type": "select",
      "id": "u:fc6740e2cc60",
      "name": "model",
      "overlay": {
        "width": "70%",
        "align": "center"
      },
      "searchable": true,
      "columns": [
        {
          "name": "label",
          "label": "描述"
        },
        {
          "name": "value",
          "label": "模型"
        }
      ],
      "selectMode": "table",
      "placeholder": "请选择模型",
      "labelClassName": "hidden",
      "multiple": false,
      "onEvent": {
        "change": {
          "actions": [
            {
              "actionType": "reload",
              "args": {
                "model": "${value}"
              },
              "componentName": "api_list"
            }
          ]
        }
      },
      "options": [
        {
          "label": "诸葛亮",
          "value": "zhugeliang",
          "position": "中单"
        },
        {
          "label": "曹操",
          "value": "caocao",
          "position": "上单"
        },
        {
          "label": "钟无艳",
          "value": "zhongwuyan",
          "position": "上单"
        },
        {
          "label": "李白",
          "value": "libai",
          "position": "打野"
        },
        {
          "label": "韩信",
          "value": "hanxin",
          "position": "打野"
        },
        {
          "label": "云中君",
          "value": "yunzhongjun",
          "position": "打野"
        }
      ]
    }
  ],
  "id": "u:e0af693c5d73",
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  }
}

错误的代码,以上是配置source作为动态数据源,在点击下拉框后,下拉列表会自动的撑开到100%宽度,overlay的配置不生效

{
  "type": "page",
  "title": "select",
  "body": [
    {
      "type": "select",
      "id": "u:fc6740e2cc60",
      "name": "model",
      "overlay": {
        "width": "70%",
        "align": "center"
      },
      "searchable": true,
      "columns": [
        {
          "name": "label",
          "label": "描述"
        },
        {
          "name": "value",
          "label": "模型"
        }
      ],
      "selectMode": "table",
      "placeholder": "请选择模型",
      "labelClassName": "hidden",
      "multiple": false,
      "onEvent": {
        "change": {
          "actions": [
            {
              "actionType": "reload",
              "args": {
                "model": "${value}"
              },
              "componentName": "api_list"
            }
          ]
        }
      },
      "source": {
        "url": "/api/v1/system/meta/model/model_name_list",
        "method": "get"
      }
    }
  ],
  "id": "u:e0af693c5d73",
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  }
}
  1. 操作步骤 请简单描述一下复现的操作步骤... 访问:http://fun.wwsheng.xyz:5099/amis-editor/#/select,输入验证码,再选择select示例代码

wwsheng009 avatar May 19 '25 01:05 wwsheng009