ant tree里面异步加载,怎么把onloadData里面替换成async请求?

想发送如下请求?

    try {
                const persons = await treeStore.search({ name: '张' });
                console.log('xxxx',persons);
            } catch (error) {
                message.error(error.message);
            }
function onLoadData({ key, children }) {
        new Promise(resolve => {
            if (children) {
                resolve();
                return;
            }
            setTimeout(() => {
                setTreeData(origin =>
                    updateTreeData(origin, key, [
                        {
                            title: 'Child Node',
                            key: `${key}-0`,
                        },
                        {
                            title: 'Child Node',
                            key: `${key}-1`,
                        },
                    ]),
                );
                resolve();
            }, 1000);
        });
    }
阅读 249
评论
    0 个回答
    撰写回答

    登录后参与交流、获取后续更新提醒

    相似问题
    推荐文章