forked from buefy/buefy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a fix to keep defined slots position for tabs
- Loading branch information
1 parent
2ba9199
commit 230faca
Showing
4 changed files
with
89 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<template> | ||
<section> | ||
<div class="block"> | ||
<b-switch v-model="showMusic"> Show Music item (using <code>v-if</code>) </b-switch> | ||
</div> | ||
<div class="block"> | ||
<b-switch v-model="showBooks"> Show books item (by adding / removing from the array) </b-switch> | ||
</div> | ||
<b-tabs v-model="activeTab"> | ||
<template v-for="(tab, index) in tabs"> | ||
<b-tab-item | ||
v-if="tab.displayed" | ||
:key="index" | ||
:label="tab.label"> | ||
{{ tab.content }} | ||
</b-tab-item> | ||
</template> | ||
</b-tabs> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data() { | ||
return { | ||
activeTab: 0, | ||
showMusic: true, | ||
showBooks: false | ||
} | ||
}, | ||
computed: { | ||
baseTabs() { | ||
return [ | ||
{ | ||
label: 'Pictures', | ||
content: 'Lorem ipsum dolor sit amet.', | ||
displayed: true, | ||
}, | ||
{ | ||
label: 'Music', | ||
content: 'Lorem ipsum dolor sit amet.', | ||
displayed: this.showMusic, | ||
}, | ||
{ | ||
label: 'Videos', | ||
content: 'Lorem ipsum dolor sit amet.', | ||
displayed: true, | ||
} | ||
] | ||
}, | ||
tabs() { | ||
const tabs = [...this.baseTabs] | ||
if (this.showBooks) { | ||
tabs.splice(tabs.length - 1, 0, this.bookTab); | ||
} | ||
return tabs | ||
}, | ||
bookTab() { | ||
return { | ||
label: 'Books', | ||
content: 'Lorem ipsum dolor sit amet.', | ||
displayed: true, | ||
} | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters