uni-app 调试时render-whole有效打包后render-whole无效

uni-app 调试时render-whole有效打包后render-whole无效

开发环境 版本号 项目创建方式
Windows win10 21H2 HBuilderX
示例代码:


```html
<view class="list-container" [@touchmove](/user/touchmove).stop [@touch](/user/touch).stop>  
    <list @loadmore="scrolltolower" @scroll="scrollList" enableBackToTop scrollWithAnimation :showScrollbar="false"  
        class="list" v-if="dataList.length > 0" v-bind="customProps" :style="{height:height+'px'}" render-whole>  

        <!--解决无法下刷新bug  -->  
<!--        <cell><text></text></cell> -->  
        <cell ref="top">  
            <view class="topEmpty" :style="'height:' + topEmptyHeight"></view>  
        </cell>  
        <cell v-for="(item, index) in dataList" :key="keyName?item[keyName]:index">  
            <slot :item="item" :index="index"></slot>  
        </cell>  
        <!--    <cell>  
            <view class="load-tips">  
                <text class="end-text" v-if="dataList.length >= total">- - END - -</text>  
                <text class="loading-tips-text" v-else>加载中...</text>  
            </view>  
        </cell> -->  
        <cell ref="bottom" v-if="bottomEmptyHeight > 0">  
            <view :style="'height:' + bottomEmptyHeight"></view>  
        </cell>  

    </list>  
    <u-empty mode="search" :text="emptyText" icon="http://cdn.uviewui.com/uview/empty/search.png" width="320"  
        height="320" textSize="28" v-if="!dataList.length && isLoaded"></u-empty>  
    <u-back-top ref="u-back-top" :scroll-top="scrollTop" :top="showBackTopOffset" @click="topClick($event)"  
        customStyle="opacity: 0.7"></u-back-top>  
</view>

操作步骤:

  • 百分百复现

预期结果:

  • 整体渲染

实际结果:

  • 逐个渲染

bug描述:

  • list 和 cell 配合使用,使用 render-whole 整体渲染,调试时真机、模拟器都有效。打包成安装包后无效,还是逐个渲染

更多关于uni-app 调试时render-whole有效打包后render-whole无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于uni-app 调试时render-whole有效打包后render-whole无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html


这是一个典型的开发环境与生产环境行为不一致的问题。关于render-whole在打包后失效的情况,以下是可能的原因和解决方案:

  1. 编译优化问题:打包时编译器可能对render-whole属性进行了优化处理,建议检查manifest.json中的优化配置

  2. 平台差异:某些平台(如iOS)对render-whole的支持可能不完全,可以尝试添加平台条件编译:

<list render-whole="true">
回到顶部