[youzan/vant-weapp][Bug] van-collapse van-collapse-item 下的内容通过setData动态改变,高度不能跟随内容改变,盖住了新增内容

2024-07-04 603 views
1

注意:请按照下面的模板来新建 issue,不规范的 issue 会被立即关闭.

描述一下问题 通过点击collapse item,只有当展开的collapse时候才去获取数据,动态加载collapse item下的数据。 发现van-collapse -》 van-collapse-item 下的渲染列表通过setData增加了,但是van-collapse-item的高度不会跟随内容自动增加. 只有第二次点击collapse item的时候才能正常展开相应的正常高度

  <van-collapse value="{{ activeCategoryList }}" custom-class="van-collapse-edit-form" data-key="activeCategoryList" bind:change="onCollapseChange">
            <van-collapse-item title="{{ category.name }}" name="{{category.id}}" wx:key="{{category.id}}" wx:for-item="category" wx:for="{{categoryList}}" custom-class="van-collapse-root" content-class="van-collapse-item__content">
                <!-- <van-icon  size="32px" name="https://b.yzcdn.cn/vant/icon-demo-1126.png" /> -->
                <view style="padding:5px;">
                    <van-icon size="30px" color="#4b0" name="add" custom-class="icon" data-category="{{category}}" bind:click="onAddWorkOrderItemClick" />
                </view>
                <view style="background-color:#F8F8F8;">
                    <view class="weui-form-preview" wx:key="{{workOrderItem.id}}" wx:for-item="workOrderItem" wx:for-index="workOrderItemIndex" wx:for="{{categoryWorkOrderItem[category.id]}}">
                        <view class="weui-form-preview__hd">
                            <view class="weui-form-preview__label">
                                {{workOrderItem.categoryName}}
                            </view>
                            <view wx:if="{{workOrderItem.state === 1}}" class="weui-form-preview__value_in-hd"><text style="color:red">改进点</text></view>
                            <view wx:else class="weui-form-preview__value_in-hd">正常</view>
                        </view>
                        <view class="weui-form-preview__bd">
                            <view class="weui-form-preview__item" wx:for="{{workOrderItem.attributeList}}" wx:key="{{attribute.id}}" wx:for-item="attribute">
                                <view class="weui-form-preview__label">
                                    {{attribute.attributeName}}
                                </view>
                                <view class="weui-form-preview__value">
                                    {{attribute.attributeValue}}
                                </view>
                            </view>
                        </view>
                        <view class="weui-form-preview__ft">
                            <view bindtap="onDeleteWorkOrderItemClick" data-category="{{category}}" data-index="{{workOrderItemIndex}}" data-work-order-item-id="{{workOrderItem.id}}" class="weui-form-preview__btn weui-form-preview__btn_default" hover-class="weui-form-preview__btn_active">
                                删除
                            </view>
                            <view bindtap="onEditWorkOrderItemClick" data-category="{{category}}" data-index="{{workOrderItemIndex}}" data-work-order-item-id="{{workOrderItem.id}}" class="weui-form-preview__btn weui-form-preview__btn_primary" hover-class="weui-form-preview__btn_active">
                                修改
                            </view>
                        </view>
                    </view>
                </view>
            </van-collapse-item>
        </van-collapse>

截图 如果是 UI 问题,请提供具体截图

环境

  • 设备: mac os
  • 基础库版本: 2.4.2
  • Vant Weapp 版本: v0.4.9

回答

8

增加新的数据都需要收起再展开才能正确显示高度。。。

2

嵌套collapse也有同样问题

1

@rex-zsd 还需要提供这个bug的其他信息吗?

8

@rex-zsd 这个问题你们那边能复现吗?我这边试了几组数据都是有问题的

1

近2周比较忙,没有及时处理,感谢pr @TonyLuo