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: { closable: {
type: Boolean, type: Boolean,
default: null default: null
} },
// Tabs tab Tabs name
tab: {
type: String
},
}, },
data () { data () {
return { return {

View file

@ -96,6 +96,10 @@
default: false default: false
}, },
beforeRemove: Function, beforeRemove: Function,
// Tabs name
name: {
type: String
},
}, },
data () { data () {
return { return {
@ -170,7 +174,20 @@
methods: { methods: {
getTabs () { getTabs () {
// return this.$children.filter(item => item.$options.name === 'TabPane'); // 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 () { updateNav () {
this.navList = []; this.navList = [];