[Tab] Cannot re-initialise tab settings #1255
HTML
<link rel="stylesheet" href="https://fomantic-ui.com/dist/semantic.css">
<script src="https://fomantic-ui.com/dist/semantic.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.11/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/fomantic/fomantic-ui@037a0402362fa2ffa44e434fe7e362c8cb753bb8/src/definitions/modules/tab.js"></script>
<div id="app">
<div class="ui top attached menu">
<example-tab v-for="tab in tabs" :label="tab.label" :start-active="tab.startActive" :data-tab="tab.label" />
</div>
<div v-for="tab in tabs" class="ui bottom attached tab segment" :class="{'active': tab.startActive}" :data-tab="tab.label">
{{tab.label}}
</div>
</div>
CSS
body {
padding: 1rem;
}
JavaScript
const Tab = {
props: ['label', 'startActive'],
template: `
<a :id="_uid" class="item tabify" :class="{'active': startActive}">
{{label}} <br> startActive: {{startActive || false}}
</a>`,
mounted() {
$('#' + this._uid).tab({
onVisible: () => {
console.log(this.label + ' is visible!')
}
})
}
};
new Vue({
el: "#app",
components: {
'example-tab': Tab
},
data: {
tabs: [{
label: 'First'
},
{
label: 'Second',
startActive: true
},
{
label: 'Third'
},
{
label: 'Fourth'
}
]
}
})