changed the way tab-switcher works to avoid removing/adding nodes since that
seems to cause issues, instead hiding nodes with css.
This commit is contained in:
parent
50562eb6b7
commit
acf414e451
@ -1,7 +1,5 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
// FIXME: This doesn't like v-if directly inside the tab's contents, breaks vue really bad
|
|
||||||
|
|
||||||
import './tab_switcher.scss'
|
import './tab_switcher.scss'
|
||||||
|
|
||||||
export default Vue.component('tab-switcher', {
|
export default Vue.component('tab-switcher', {
|
||||||
@ -27,11 +25,14 @@ export default Vue.component('tab-switcher', {
|
|||||||
}
|
}
|
||||||
return (<button onClick={this.activateTab(index)} class={ classes.join(' ') }>{slot.data.attrs.label}</button>)
|
return (<button onClick={this.activateTab(index)} class={ classes.join(' ') }>{slot.data.attrs.label}</button>)
|
||||||
});
|
});
|
||||||
const contents = (
|
const contents = this.$slots.default.filter(_=>_.data).map(( slot, index ) => {
|
||||||
<div>
|
const active = index === this.active
|
||||||
{this.$slots.default.filter(slot => slot.data)[this.active]}
|
return (
|
||||||
|
<div class={active ? 'active' : 'hidden'}>
|
||||||
|
{slot}
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<div class="tab-switcher">
|
<div class="tab-switcher">
|
||||||
<div class="tabs">
|
<div class="tabs">
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
@import '../../_variables.scss';
|
@import '../../_variables.scss';
|
||||||
|
|
||||||
.tab-switcher {
|
.tab-switcher {
|
||||||
|
.contents {
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
.tabs {
|
.tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
Loading…
Reference in New Issue
Block a user