Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Set tab visibility #16

Merged
merged 2 commits into from
Oct 6, 2017
Merged

Conversation

manelclos
Copy link
Contributor

Hi,

I needed other tabs to be hidden until an address is selected in the only tab that is left. I can hide/show tabs now with these modifications.

@sebastiandedeyne
Copy link
Member

Not sure, but couldn't you already use v-if for this?

@manelclos
Copy link
Contributor Author

Hi @sebastiandedeyne, I tried to use v-if, but not rendering the tab also means not rendering the tab content. There are two reasons you might not want this: 1) rendering is expensive 2) content in the tab is not rendered by the component itself, but rather added to the content pane using jQuery (my use case), and it will be lost when not rendering it. So internally the Tab uses v-show, as v-show does not work on the tab tag.

@sebastiandedeyne
Copy link
Member

Could you post an example of how you're exactly using this? If isVisible is true by default, won't it always render first anyway?

@manelclos
Copy link
Contributor Author

Yes, it is rendered first time. I'm putting a form in the first tab which is not managed by Vue. Using v-if would cause the form to be lost (I tried that already). You could also think about an expensive rendering you don't want to repeat. On startup, I check if the form in the first tab is all empty, in that case the tab is hidden (setTabVisible=false), and the second tab gets the focus. Second tab contains a search form. Once you select a value in the search form results, the form in the first tab is populated, so no longer empty, which will cause the logic to show the first tab (setTabVisible=true).

@sebastiandedeyne sebastiandedeyne merged commit c1e9ac5 into spatie:master Oct 6, 2017
@sebastiandedeyne
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants