parent
41fab82296
commit
dd62e7f58c
|
@ -44,11 +44,11 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
tabs: []
|
||||
d_children: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.tabs = this.$children.filter(child => child.$options._componentTag.indexOf('AccordionTab')===0);
|
||||
this.d_children = this.$children;
|
||||
},
|
||||
methods: {
|
||||
onTabClick(event, tab) {
|
||||
|
@ -76,6 +76,11 @@ export default {
|
|||
return this.props.multiple ? (this.d_activeTabIndex && this.d_activeTabIndex.indexOf(index) >= 0) : this.d_activeTabIndex === index;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
tabs() {
|
||||
return this.d_children.filter(child => child.$vnode.tag.indexOf('accordiontab') !== -1);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'AccordionTabSlot': AccordionTabSlot
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'accordiontab',
|
||||
props: {
|
||||
header: null,
|
||||
active: Boolean,
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
name: 'tabpanel',
|
||||
props: {
|
||||
header: null,
|
||||
active: Boolean,
|
||||
|
|
|
@ -31,16 +31,11 @@ const TabPanelHeaderSlot = {
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
tabs: []
|
||||
d_children: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.tabs = this.$children;
|
||||
|
||||
let activeTab = this.findActiveTab();
|
||||
if (!activeTab && this.tabs.length) {
|
||||
this.tabs[0].d_active = true;
|
||||
}
|
||||
this.d_children = this.$children;
|
||||
},
|
||||
methods: {
|
||||
onTabClick(event, tab) {
|
||||
|
@ -78,6 +73,17 @@ export default {
|
|||
return activeTab;
|
||||
}
|
||||
},
|
||||
updated() {
|
||||
let activeTab = this.findActiveTab();
|
||||
if (!activeTab && this.tabs.length) {
|
||||
this.tabs[0].d_active = true;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
tabs() {
|
||||
return this.d_children.filter(child => child.$vnode.tag.indexOf('tabpanel') !== -1);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'TabPanelHeaderSlot': TabPanelHeaderSlot
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue