This commit is contained in:
梁灏 2019-03-08 14:56:06 +08:00
parent d6e14b116e
commit 26b2cfa02f
2 changed files with 23 additions and 2 deletions

View file

@ -25,7 +25,11 @@
closable: {
type: Boolean,
default: null
}
},
// Tabs tab Tabs name
tab: {
type: String
},
},
data () {
return {

View file

@ -96,6 +96,10 @@
default: false
},
beforeRemove: Function,
// Tabs name
name: {
type: String
},
},
data () {
return {
@ -170,7 +174,20 @@
methods: {
getTabs () {
// return this.$children.filter(item => item.$options.name === 'TabPane');
return findComponentsDownward(this, 'TabPane');
const AllTabPanes = findComponentsDownward(this, 'TabPane');
const TabPanes = [];
AllTabPanes.forEach(item => {
if (item.tab && this.name) {
if (item.tab === this.name) {
TabPanes.push(item);
}
} else {
TabPanes.push(item);
}
});
return TabPanes;
},
updateNav () {
this.navList = [];