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

fix: 修复级联选择器数据源异常label为数组时页面崩溃的问题 #10836

Merged

Conversation

CheshireJCat
Copy link
Collaborator

当数据源为api返回是以下内容时

{
    "status": 0,
    "msg": "",
    "data": {
      "links":
        [{ "label": "Nav 1", "to": "?cat=1", "value": "1", "icon": "fa fa-user" }, { "label": "Nav 2", "unfolded": true, "children": [{ "label": "Nav 2-1", "children": [{ "label": "Nav 2-1-1", "to": "?cat=2-1", "value": "2-1" }] }, { "label": "Nav 2-2", "to": "?cat=2-2", "value": "2-2" }] }, { "label": "Nav 3", "to": "?cat=3", "value": "3", "defer": true }],
      "value": "?cat=1"
    }
  }

会引发页面崩溃
image

需要对labelji进行兼容处理

@github-actions github-actions bot added the fix label Aug 27, 2024
Copy link

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

Please review the labels and make any necessary changes.

@2betop
Copy link
Collaborator

2betop commented Aug 27, 2024

你这示例的 label 看起来都是正常的呢

@CheshireJCat
Copy link
Collaborator Author

你这示例的 label 看起来都是正常的呢

@2betop label是正常的,但是仔细看数据不是options,而是links,这种特殊情况,links 的值会被当成 label,
也就是说,当前label是个 数组[{ "label": "Nav 1", "to": "?cat=1", "value": "1", "icon": "fa fa-user" },....],但这数据不是schema,所以导致渲染报错了

@hsm-lv hsm-lv merged commit c84baa4 into baidu:master Aug 27, 2024
6 checks passed
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 this pull request may close these issues.

4 participants