5***@qq.com
5***@qq.com
  • 发布:2023-08-01 14:24
  • 更新:2023-08-03 15:35
  • 阅读:401

【报Bug】onPullDownRefresh事件总是无法触发。报错: VM13:1 onPullDownRefresh WebviewId: 1 not found

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 10.14.6

HBuilderX类型: 正式

HBuilderX版本号: 3.8.7

第三方开发者工具版本号: 1.06.2306020

基础库版本号: 2.33.0

手机系统: iOS

手机系统版本号: iOS 16

手机厂商: 苹果

手机机型: iphone14plus

页面类型: vue

vue版本: vue3

打包方式: 离线

项目创建方式: HBuilderX

示例代码:

下拉页面的完整代码:

<template>  
    <view>  
        <page-head :title="title"></page-head>  
        <view class="uni-padding-wrap uni-common-mt">  
            <view style="font-size: 12px; color: #666;">注:PC 不支持下拉刷新</view>  
            <view class="text" v-for="(num,index) in data" :key="index">list - {{num}}</view>  
            <view class="uni-loadmore" v-if="showLoadMore">{{loadMoreText}}</view>  
        </view>  
    </view>  
</template>  
<script>  
    export default {  
        data() {  
            return {  
                title: '下拉刷新 + 加载更多',  
                data: [],  
                loadMoreText: "加载中...",  
                showLoadMore: false,  
                max: 0  
            }  
        },  
        onLoad() {  
            this.initData();  
        },  
        onUnload() {  
            this.max = 0,  
            this.data = [],  
            this.loadMoreText = "加载更多",  
            this.showLoadMore = false;  
        },  
        onReachBottom() {  
            console.log("onReachBottom");  
            if (this.max > 40) {  
                this.loadMoreText = "没有更多数据了!"  
                return;  
            }  
            this.showLoadMore = true;  
            setTimeout(() => {  
                this.setListData();  
            }, 300);  
        },  
        onPullDownRefresh() {  
            console.log('onPullDownRefresh');  
            this.initData();  
        },  
        methods: {  
            initData(){  
                setTimeout(() => {  
                    this.max = 0;  
                    this.data = [];  
                    let data = [];  
                    this.max += 20;  
                    for (var i = this.max - 19; i < this.max + 1; i++) {  
                        data.push(i)  
                    }  
                    this.data = this.data.concat(data);  
                    uni.stopPullDownRefresh();  
                }, 300);  
            },  
            setListData() {  
                let data = [];  
                this.max += 10;  
                for (var i = this.max - 9; i < this.max + 1; i++) {  
                    data.push(i)  
                }  
                this.data = this.data.concat(data);  
            }  
        }  
    }  
</script>  

<style>  
    .text {  
        margin: 16rpx 0;  
        width:100%;  
        background-color: #fff;  
        height: 120rpx;  
        line-height: 120rpx;  
        text-align: center;  
        color: #555;  
        border-radius: 8rpx;  
    }  
</style>  

操作步骤:

pages.json文件中的部分配置内容:

        {  
            "path" : "pages/test/test",  
            "style" :                                                                                      
            {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": true  
            }  

        }

预期结果:

下拉页面实现刷新

实际结果:

下拉后页面提示未找到onPullDownRefresh 代码:
VM13:1 onPullDownRefresh WebviewId: 1 not found

bug描述:

iphone14plus 版本16.0.3。onPullDownRefresh事件总是无法触发。报错:
VM13:1 onPullDownRefresh WebviewId: 1 not found

代码直接粘贴的uniapp的hello-uniapp的事例,非常简单 代码如下(源代码位置在:pages/API/pull-down-refresh/pull-down-refresh.vue):

    onPullDownRefresh() {  
            console.log('onPullDownRefresh');  
            this.initData();  
        },  
        methods: {  
            initData(){  
                setTimeout(() => {  
                    this.max = 0;  
                    this.data = [];  
                    let data = [];  
                    this.max += 20;  
                    for (var i = this.max - 19; i < this.max + 1; i++) {  
                        data.push(i)  
                    }  
                    this.data = this.data.concat(data);  
                    uni.stopPullDownRefresh();  
                }, 300);  
            },  
            setListData() {  
                let data = [];  
                this.max += 10;  
                for (var i = this.max - 9; i < this.max + 1; i++) {  
                    data.push(i)  
                }  
                this.data = this.data.concat(data);  
            }  
        }

也在pages.json中添加了配置:

            "path" : "pages/test/test",  
            "style" :                                                                                      
            {  
                "navigationBarTitleText": "",  
                "enablePullDownRefresh": true  
            }

界面如下:

调试基库 2.33.0 (换过其他基库一样没用)

真机调试时实际报错内容:

我看了下在远程代理也有onPullDownRefresh的代码的,不知道为什么说找不到?

我看很多人在微信社区也问这个问题,希望官方能解决。

2023-08-01 14:24 负责人:无 分享
已邀请:
DCloud_UNI_Anne

DCloud_UNI_Anne

未复现此问题 直接使用微信小程序(不使用 uni-app )测试一下是否正常

  • 5***@qq.com (作者)

    这个问题出现在版本是iOS16.0.3。

    2023-08-07 10:52

  • JoeX

    回复 5***@qq.com: 我ios17也出现了,下拉刷新不起作用了

    2023-12-08 16:37

要回复问题请先登录注册