diff options
| author | shpuld <shp@cock.li> | 2019-02-03 10:13:09 +0200 |
|---|---|---|
| committer | shpuld <shp@cock.li> | 2019-02-03 10:13:09 +0200 |
| commit | b614cb94e502f3491afd07e5bcb785ad122cf100 (patch) | |
| tree | 289e82bd2f5667ab773bb838a88dd312bba90edf /src/components/tab_switcher | |
| parent | dbb16d56e29b8a32fb7c1a7af56a7953f571cdb4 (diff) | |
| parent | c7ee2ed83100e40247fc35be8b138befc44175bc (diff) | |
merge develop in
Diffstat (limited to 'src/components/tab_switcher')
| -rw-r--r-- | src/components/tab_switcher/tab_switcher.js (renamed from src/components/tab_switcher/tab_switcher.jsx) | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/tab_switcher/tab_switcher.jsx b/src/components/tab_switcher/tab_switcher.js index 9038733c..f9c3f927 100644 --- a/src/components/tab_switcher/tab_switcher.jsx +++ b/src/components/tab_switcher/tab_switcher.js @@ -4,6 +4,7 @@ import './tab_switcher.scss' export default Vue.component('tab-switcher', { name: 'TabSwitcher', + props: ['renderOnlyFocused'], data () { return { active: this.$slots.default.findIndex(_ => _.tag) @@ -44,11 +45,12 @@ export default Vue.component('tab-switcher', { const contents = this.$slots.default.map((slot, index) => { if (!slot.tag) return const active = index === this.active - return ( - <div class={active ? 'active' : 'hidden'}> - {slot} - </div> - ) + if (this.renderOnlyFocused) { + return active + ? <div class="active">{slot}</div> + : <div class="hidden"></div> + } + return <div class={active ? 'active' : 'hidden' }>{slot}</div> }) return ( |
