fixed #5377
This commit is contained in:
parent
d6e14b116e
commit
26b2cfa02f
2 changed files with 23 additions and 2 deletions
|
@ -25,7 +25,11 @@
|
|||
closable: {
|
||||
type: Boolean,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
// Tabs 嵌套时,用 tab 区分层级,指向对应的 Tabs 的 name
|
||||
tab: {
|
||||
type: String
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
|
|
@ -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 = [];
|
||||
|
|
Loading…
Add table
Reference in a new issue