GSCOSMOS
GSCOSMOS
  • 发布:2023-12-09 16:00
  • 更新:2023-12-09 22:42
  • 阅读:144

scroll-view在真机上无法使用refresher插槽

分类:uni-app

在H5和微信小程序中使用scroll-view的refresher插槽都能正常使用。但是到了App真机上的时候,就会报错[plugin:vite:vue] Codegen node is missing for element/if/for node. Apply appropriate transforms first.

2023-12-09 16:00 负责人:无 分享
已邀请:

最佳回复

喜欢技术的前端

喜欢技术的前端 - QQ---445849201

作者 uni_modules/jp-virtual-list/components/jp-virtual-list/jp-virtual-list.vue 30行使用了 transition元素,这个元素在App不支持,可以做条件编译

<!-- #ifndef APP-PLUS -->  
        <div class="_backtop" v-if="isBackTop && direction=='bottom'" @click.stop="toTop">  
            <view v-if="old.scrollTop > 100">  
                <transition name="fade" appear>  
                    <div class="top">  
                        <image src="./top.png"></image>  
                    </div>  
                </transition>  
            </view>  
        </div>  
        <!-- #endif -->  

另 scroll 事件有逻辑,可以写防抖提高性能 data定义 scrollTimer:null  

scroll: function(e) { //滚动过程  
                if(this.scrollTimer){  
                    clearTimeout(this.scrollTimer)  
                }  
                let that = this  
                this.scrollTimer = setTimeout(()=>{  
                    if (e.detail.scrollHeight > (e.detail.scrollTop + this.clientHeight + 200)) {  
                        this.lowers = false  
                    }  
                    this.old.scrollTop = e.detail.scrollTop  
                },1000)  
            },  

要回复问题请先登录注册