1、h5安装inobounce
npm install inobounce
2、页面中
<script setup>
import inobounce from 'inobounce'
onMounted(() => {
//iOS
if (navigator.userAgent.indexOf('iPhone') > -1) {
inobounce.enable() //iOS设备开始禁止橡皮筋效果回弹
}
})
onBeforeUnmount(() => {
inobounce.disable()
})
</script>
3、iOS设备上下滑动就不会出现webview的‘此网页由xxx提供’。
4、如果页面中有需要滚动的区域,添加类似以下样式:
.scroll-style {
overflow-y: auto;
-webkit-overflow-scrolling: touch; //在iOS设备上启用平滑滚动效果
}
参考文章: