Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amis组件options属性中label字段无法解析JavaScript 模板引擎(<% 这里面是 js 语句 %>) #6598

Closed
Niceyb opened this issue Apr 13, 2023 · 2 comments · Fixed by #6614
Assignees
Labels

Comments

@Niceyb
Copy link

Niceyb commented Apr 13, 2023

描述问题:

在Radio、Transfer等组件中得options属性上配置label字段时使用JavaScript 模板引擎将不被解析而直接以字符串形式展示

截图或视频:

image

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

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

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

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

{
  "type": "page",
  "body": [
    {
      "label": "组合穿梭器",
      "type": "tabs-transfer",
      "name": "a",
      "sortable": true,
      "searchable": true,
      "options": [
        {
          "label": "<%= date(data.xxx) %>",
          "selectMode": "tree",
          "children": [
            {
              "label": "法师",
              "children": [
                {
                  "label": "诸葛亮",
                  "value": "zhugeliang"
                }
              ]
            },
            {
              "label": "战士",
              "children": [
                {
                  "label": "曹操",
                  "value": "caocao"
                },
                {
                  "label": "钟无艳",
                  "value": "zhongwuyan"
                }
              ]
            },
            {
              "label": "打野",
              "children": [
                {
                  "label": "李白",
                  "value": "libai"
                },
                {
                  "label": "韩信",
                  "value": "hanxin"
                },
                {
                  "label": "云中君",
                  "value": "yunzhongjun"
                }
              ]
            }
          ]
        },
        {
          "label": "用户",
          "selectMode": "chained",
          "children": [
            {
              "label": "法师",
              "children": [
                {
                  "label": "诸葛亮",
                  "value": "zhugeliang2"
                }
              ]
            },
            {
              "label": "战士",
              "children": [
                {
                  "label": "曹操",
                  "value": "caocao2"
                },
                {
                  "label": "钟无艳",
                  "value": "zhongwuyan2"
                }
              ]
            },
            {
              "label": "打野",
              "children": [
                {
                  "label": "李白",
                  "value": "libai2"
                },
                {
                  "label": "韩信",
                  "value": "hanxin2"
                },
                {
                  "label": "云中君",
                  "value": "yunzhongjun2"
                }
              ]
            }
          ]
        }
      ],
      "id": "u:e2b5feecdbf8"
    }
  ],
  "id": "u:7709a8d6c490"
}
@2betop
Copy link
Collaborator

2betop commented Apr 14, 2023

每一层 options label 没有支持,但是 tabs 那层的 label 可以支持,已提 pr

@Niceyb
Copy link
Author

Niceyb commented Apr 18, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants