Skip to content

[tabs] panel使用wx:if后加载时,tab顺序、panel顺序和panel高度错乱 #3402

@ITsPro-CN

Description

@ITsPro-CN

tdesign-miniprogram 版本

1.8.4

重现链接

https://developers.weixin.qq.com/s/GinDHJm27eWo

重现步骤

t-tabs组件包含若干个t-tab-panel,其中部分使用了wx:if加载,请查看代码片段。
如果wx:if的组件在前,则tab顺序错乱,panel内容正确,panel高度错乱。
如果wx:if的组件在后,则tab顺序错乱,panel内容错乱,panel高度正确。

我感觉是不是要给tab-panel加个sort属性,看了一下tabs.js的line43-45:

linked(target) {
    this.children.push(target);
    this.initChildId();
    target.index = this.children.length - 1;
    this.updateTabs();
}

很明显是后加载的panel在后面,而panel的位置是按组件位置的。

期望结果

No response

实际结果

No response

基础库版本

No response

补充说明

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions