使用的是动态设置下拉刷新的功能解决的,在app上亲测可用,在H5上会报错
isPullDown(isPull) {
const pages = getCurrentPages();//获取页面实列
const page = pages[pages.length - 1]; //获取最上层页面实列
const currentWebview = page.$getAppWebview();//获取当前页面对应的Webview实列
currentWebview.setStyle({
pullToRefresh: {
support: isPull,
}
});
},
如果在H5上使用,则会导致报错,并且在取消弹框时候,也会取消不了则需要添加仅APP可使用
(// #ifdef APP-PLUS和// #endif)则是仅APP可使用
show()是开启弹框,isPull 为 false,则调用 setStyle() 方法禁用当前 Webview 实例的下拉刷新功能。
close()是关闭弹窗,isPull 为 true,则调用 setStyle() 方法设置当前 Webview 实例支持下拉刷新。
show(){
this.isShow = true
// #ifdef APP-PLUS
this.isPullDown(false);
// #endif
}
close(){
// #ifdef APP-PLUS
this.isPullDown(true);
// #endif
this.isShow = false
},