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

How to expand all level 2 titles in sidebar including inactive pages?如何展开侧边栏的所有标题? #534

Closed
imageslr opened this issue May 31, 2018 · 3 comments
Labels
contribution welcome Contributions welcome type: feature request Request to add a new feature

Comments

@imageslr
Copy link
Contributor

imageslr commented May 31, 2018

Feature request

Add a configuration item like collapsable to support expanding all level 2 titles in sidebar including which of inactive pages.

添加一个类似collapsable的配置项,以默认在侧边栏显示所有标题。

What problem does this feature solve?

Currently the sidebar will only show level 2 titles in current active page. I want to display all level 2 titles even it's an unfocus page. Like this:

目前侧边栏只会显示当前页面的二级标题,我希望展开所有页面的二级标题,就像这样:

image

What does the proposed API look like?

sidebar: {
 //...
},
expandAllGroup: true

How should this be implemented in your opinion?

When server generates sidebar arrays, add all level 2 titles in that array instead of only adding that of current active page.

在生成侧边栏的时候,把所有页面的二级标题都显示出来,而不是只显示当前页面的二级标题。

Maybe modify following codes in line 4:

<SidebarGroup v-if="item.type === 'group'"
    :item="item"
    :first="i === 0"
    :open="i === openGroupIndex" // change to → :open="expandAllGroup || i === openGroupIndex"
    :collapsable="item.collapsable"
    @toggle="toggleGroup(i)"
/>

Are you willing to work on this yourself?

I never contribute to a big project before. It couldn't be better if I can do it.

@ulivz
Copy link
Member

ulivz commented Jun 1, 2018

PR welcome!

@ulivz ulivz added contribution welcome Contributions welcome type: feature request Request to add a new feature labels Jun 1, 2018
@imageslr
Copy link
Contributor Author

imageslr commented Jun 2, 2018

Great! I will work on this after a few days😄.

@imageslr
Copy link
Contributor Author

imageslr commented Jun 16, 2018

I have finished this feat yesterday. Thanks for reviewing my pr @ulivz .

@ulivz ulivz closed this as completed in 36bb6a4 Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome Contributions welcome type: feature request Request to add a new feature
Projects
None yet
Development

No branches or pull requests

2 participants