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