[bugfix] Tab: insert order (#1372)

This commit is contained in:
neverland
2018-07-01 08:06:48 +08:00
committed by GitHub
parent e25dde299a
commit cc8951ffcd
2 changed files with 5 additions and 1 deletions

View File

@@ -49,7 +49,10 @@ export default create({
created() {
this.findParent('van-tabs');
this.parent.tabs.push(this);
const { tabs } = this.parent;
const index = this.parent.$slots.default.indexOf(this.$vnode);
tabs.splice(index === -1 ? tabs.length : index, 0, this);
},
mounted() {