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: {
|
closable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: null
|
default: null
|
||||||
}
|
},
|
||||||
|
// Tabs 嵌套时,用 tab 区分层级,指向对应的 Tabs 的 name
|
||||||
|
tab: {
|
||||||
|
type: String
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -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 = [];
|
||||||
|
|
Loading…
Add table
Reference in a new issue