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

Batch collapse and expand menus by function method #1536

Closed
jahnli opened this issue Nov 7, 2021 · 7 comments · Fixed by #1541
Closed

Batch collapse and expand menus by function method #1536

jahnli opened this issue Nov 7, 2021 · 7 comments · Fixed by #1541
Labels
feature request New feature or request

Comments

@jahnli
Copy link
Collaborator

jahnli commented Nov 7, 2021

This function solves the problem (这个功能解决的问题)

Batch collapse and expand menus by function method

Expected API (期望的 API)

Batch collapse and expand menus by function method

@github-actions github-actions bot added the feature request New feature or request label Nov 7, 2021
@07akioni
Copy link
Collaborator

07akioni commented Nov 7, 2021

@Talljack use watcheffect to initilize the uncontrolledExpandedKeys

@jahnli
Copy link
Collaborator Author

jahnli commented Nov 8, 2021

@07akioni Are you considering similar control functions like iView and Ant

@Talljack
Copy link
Contributor

Talljack commented Nov 8, 2021

@Talljack use watcheffect to initilize the uncontrolledExpandedKeys

OK

@07akioni
Copy link
Collaborator

07akioni commented Nov 8, 2021

@07akioni Are you considering similar control functions like iView and Ant

No, if you reset default-value to [], the collapsed state would be reset.

However, why don't you just using v-model:expandedKeys and reset the expandedKeys?

@07akioni
Copy link
Collaborator

07akioni commented Nov 8, 2021

@Talljack 我想了一下这么做有点问题就是如果用户写了 <n-menu :default-expanded-keys="[]" /> 的话每次重新渲染都会触发 watchEffect,这样也有点小问题,所以在 watchEffect 要检查两次的数组是不是包含的值没变化。

@07akioni
Copy link
Collaborator

新增了一个 watch-props 的属性解决了

@jahnli
Copy link
Collaborator Author

jahnli commented Nov 15, 2021

@07akioni Is it possible to provide demo in the document for everyone's reference

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

Successfully merging a pull request may close this issue.

3 participants