mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Tab: random insert order (#1429)
This commit is contained in:
parent
72a88f1954
commit
33cd446581
@ -49,19 +49,19 @@ export default create({
|
||||
|
||||
created() {
|
||||
this.findParent('van-tabs');
|
||||
|
||||
const { tabs } = this.parent;
|
||||
const index = this.parent.$slots.default.indexOf(this.$vnode);
|
||||
tabs.splice(index === -1 ? tabs.length : index, 0, this);
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const { tabs } = this.parent;
|
||||
const index = this.parent.$slots.default.indexOf(this.$vnode);
|
||||
tabs.splice(index === -1 ? tabs.length : index, 0, this);
|
||||
|
||||
if (this.$slots.title) {
|
||||
this.parent.renderTitle(this.$refs.title, this.index);
|
||||
}
|
||||
},
|
||||
|
||||
destroyed() {
|
||||
beforeDestroy() {
|
||||
this.parent.tabs.splice(this.index, 1);
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user