mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
* fix 2604&2661 解决动态添加tabs列表内容时,顺序错乱以及下划线长度不变的问题。 * 修改备注 * 修改方法命名、删除相关注释 * 删除注释
This commit is contained in:
parent
8e1af8e420
commit
37a39298e1
@ -10,9 +10,9 @@ component_1.VantComponent({
|
|||||||
name: 'tab',
|
name: 'tab',
|
||||||
type: 'descendant',
|
type: 'descendant',
|
||||||
linked: function (target) {
|
linked: function (target) {
|
||||||
target.index = this.children.length;
|
this.children = this.getChildren();
|
||||||
this.children.push(target);
|
|
||||||
this.updateTabs();
|
this.updateTabs();
|
||||||
|
this.setLine();
|
||||||
},
|
},
|
||||||
unlinked: function (target) {
|
unlinked: function (target) {
|
||||||
this.children = this.children
|
this.children = this.children
|
||||||
@ -22,6 +22,7 @@ component_1.VantComponent({
|
|||||||
return child;
|
return child;
|
||||||
});
|
});
|
||||||
this.updateTabs();
|
this.updateTabs();
|
||||||
|
this.setLine();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -282,6 +283,14 @@ component_1.VantComponent({
|
|||||||
this.setCurrentIndex(currentIndex + 1);
|
this.setCurrentIndex(currentIndex + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
getChildren: function () {
|
||||||
|
var nodes = this.getRelationNodes('../tab/index')
|
||||||
|
nodes.map((child, index) => {
|
||||||
|
child.index = index;
|
||||||
|
return child;
|
||||||
|
})
|
||||||
|
return nodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user