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

Tree 树形控件,onchange获取的值异常 #2508

Open
sp4rkw opened this issue Sep 23, 2024 · 7 comments
Open

Tree 树形控件,onchange获取的值异常 #2508

sp4rkw opened this issue Sep 23, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@sp4rkw
Copy link

sp4rkw commented Sep 23, 2024

简单 JSON 格式的数据,如果json有三层,,onchange获取的值异常
image

import React from 'react';
import { Tree } from '@douyinfe/semi-ui';

() => {
    const json = {
        "Node1": {
            "Child Node11": {
            "Child Node13": '0-0-1',
            "Child Node12": '0-0-99',
        },
            "Child Node9": {
            "Child Node91": '9-1',
            "Child Node92": '9-99',
        },
        },
        "Node2": "0-1"
    };
    const style = {
        width: 260,
        height: 420,
        border: '1px solid var(--semi-color-border)'
    };
    return (
        <Tree
            treeDataSimpleJson={json}
            multiple
            onChange={e => console.log('当前所有选中项: ', e)}
            onSelect={e => console.log('当前选项: ', e)}
            style={style}
        />

    );
};

如果此处是预期内的bug问题,那有什么替代的实现方案么?

@sp4rkw sp4rkw added the feature request Request new feature label Sep 23, 2024
@YyumeiZhang YyumeiZhang self-assigned this Sep 23, 2024
@YyumeiZhang YyumeiZhang added bug Something isn't working and removed feature request Request new feature labels Sep 23, 2024
@YyumeiZhang
Copy link
Collaborator

这个问题应该属于 bug,我们这边做下修复,预计跟下个正式版(2.67.0)

@YyumeiZhang
Copy link
Collaborator

@sp4rkw 使用 onChange 是想要受控吗?

@sp4rkw
Copy link
Author

sp4rkw commented Sep 24, 2024

@sp4rkw 使用 onChange 是想要受控吗?
使用onchange结合value是为了解决初始被选中值,由服务端传递来渲染

@YyumeiZhang
Copy link
Collaborator

YyumeiZhang commented Sep 24, 2024

我这边发现 json 模式下的 value 受控有点问题,这个问题的解决比昨天预先的要复杂一些。@sp4rkw 是属于字节内部用户还是外部用户?

@YyumeiZhang
Copy link
Collaborator

这个问题应该属于 bug,我们这边做下修复,预计跟下个正式版(2.67.0)

由于发现其他问题,需要其他时间处理,预计 10 月跟进

@sp4rkw
Copy link
Author

sp4rkw commented Sep 26, 2024

我这边发现 json 模式下的 value 受控有点问题,这个问题的解决比昨天预先的要复杂一些。@sp4rkw 是属于字节内部用户还是外部用户?

外部用户

@sp4rkw
Copy link
Author

sp4rkw commented Oct 22, 2024

这个问题应该属于 bug,我们这边做下修复,预计跟下个正式版(2.67.0)

由于发现其他问题,需要其他时间处理,预计 10 月跟进

大佬有空跟进一下哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants