uni-app 编译成百度小程序 onPullDownRefresh 失效
uni-app 编译成百度小程序 onPullDownRefresh 失效
| 类别 | 信息 |
|---|---|
| 产品分类 | uniapp/小程序/百度 |
| PC开发环境 | Windows |
| 操作系统版本 | Windows10 |
| HBuilderX类型 | 正式 |
| HBuilderX版本 | 3.1.7 |
| 工具版本 | 3.34.1 |
| 基础库版本 | 3.190.255-rc |
| 项目创建方式 | HBuilderX |
示例代码:
onPullDownRefresh(e) {
console.log('onPullDownRefresh')
}
对应的page.json:
"enablePullDownRefresh": true
操作步骤:
- 运行到百度小程序
预期结果:
- 可以下拉刷新
实际结果:
- 没有下拉刷新的效果,也没有触发onPullDownRefresh事件
bug描述:
- 运行成H5、微信小程序都没问题,百度小程序下拉刷新失效。
更多关于uni-app 编译成百度小程序 onPullDownRefresh 失效的实战教程也可以访问 https://www.itying.com/category-93-b0.html
4 回复
测试未发现问题,更新HBuilderX到最新版本试试
更多关于uni-app 编译成百度小程序 onPullDownRefresh 失效的实战教程也可以访问 https://www.itying.com/category-93-b0.html
真机可以但是开发者工具里不行
这是一个百度小程序平台的兼容性问题。在百度小程序中,下拉刷新需要在页面配置中额外设置 pullRefresh 参数。
修改你的 page.json 配置:
{
"enablePullDownRefresh": true,
"pullRefresh": {
"support": true,
"style": "default"
}
}
同时确保在页面生命周期中正确监听下拉刷新事件:
export default {
onPullDownRefresh() {
console.log('下拉刷新触发');
// 你的刷新逻辑
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
}
}


