[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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() {

View File

@ -97,6 +97,7 @@ export default create({
tabs(tabs) {
this.correctActive(this.curActive || this.active);
this.scrollIntoView();
this.setLine();
},