Skip to content

如何指定stat.open=node.open_default #154

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

Closed
yichuhaoshuai opened this issue May 5, 2025 · 4 comments
Closed

如何指定stat.open=node.open_default #154

yichuhaoshuai opened this issue May 5, 2025 · 4 comments

Comments

@yichuhaoshuai
Copy link

open_default是后端数据,打算在一开始显示时决定节点是+或是-,看到了getStat(node),但是在Vue3的<script setup>里应该如何使用?tree.value.getStat(node)无法获取数据

@phphe
Copy link
Owner

phphe commented May 5, 2025

调用getStat需要树准备好。你的需求建议使用statHandler,statHandler在生成stat时被调用。

@yichuhaoshuai
Copy link
Author

<script setup> const statHandler = (targetStat) => { console.log('statHandler_statHandler') // console.log(targetStat.open) } </script>

出现了Cannot read properties of undefined (reading 'children')
这里应该如何设计?哪里有例子吗

@phphe
Copy link
Owner

phphe commented May 5, 2025

statHandler 必须返回stat,可以返回第一个参数

@yichuhaoshuai
Copy link
Author

明白了,谢谢大神

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

No branches or pull requests

2 participants