1

uni-app关闭系统侧边滑动返回的方法总汇

 2 years ago
source link: https://www.fly63.com/article/detial/11269
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
更新日期: 2022-03-18阅读量: 359标签: uniapp分享

扫一扫分享

 无论安卓还是IOS,系统都自带左侧滑动返回上一页的功能,在实际开发中,我们可能需要关闭系统侧边滑动返回的功能,在uni-app中如何实现呢?下面给出几种解决方案。

单个窗口锁定

// #ifdef APP-PLUS
let page = this.$mp.page.$getAppWebview();
page.setStyle({ popGesture: 'none' });
// #endif
// #ifdef APP-PLUS
plus.webview.currentWebview().setStyle({
'popGesture': 'none'
});
// #endif

在pages.json该页面加入"popGesture": "none"

"pages": [{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"app-plus": {// App特定样式
"popGesture": "none"
}
}
}]


打开manifest源码视图,app-plus下配 "popGesture": "none"
// app-plus 节点是 App 特有配置。
"app-plus": {
"popGesture": "none"
}

iOS上是否支持屏幕左边滑动关闭当前页面。默认是可关闭。设为none则不响应左滑动画。

链接: https://www.fly63.com/article/detial/11269


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK