[new feature] Tabbar: use relation mixin

This commit is contained in:
陈嘉涵
2019-05-06 20:46:16 +08:00
parent 9c6c10fdcd
commit e6dbe06ee8
3 changed files with 15 additions and 18 deletions

View File

@@ -15,7 +15,12 @@ export function ChildrenMixin(parent) {
created() {
const { children } = this.parent;
const index = this.parent.slots().indexOf(this.$vnode);
children.splice(index === -1 ? children.length : index, 0, this);
if (index === -1) {
children.push(this);
} else {
children.splice(index, 0, this);
}
},
beforeDestroy() {