mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-07 15:45:08 +08:00
初始化 uniapp 小程序
This commit is contained in:
23
yudao-vue-ui/components/mescroll-uni/wxs/bounce.js
Normal file
23
yudao-vue-ui/components/mescroll-uni/wxs/bounce.js
Normal file
@ -0,0 +1,23 @@
|
||||
// bounce: iOS橡皮筋,Android半月弧,h5浏览器下拉背景等效果, 适用于h5和renderjs (下拉刷新时禁止)
|
||||
const bounce = {
|
||||
// false: 禁止bounce; true:允许bounce
|
||||
setBounce: function(isBounce){
|
||||
window.$isMescrollBounce = isBounce
|
||||
}
|
||||
}
|
||||
|
||||
// 引入即自动初始化 (仅初始化一次)
|
||||
if(window && window.$isMescrollBounce == null){
|
||||
// 是否允许bounce, 默认允许
|
||||
window.$isMescrollBounce = true
|
||||
// 每次点击时重置bounce
|
||||
window.addEventListener('touchstart', function(){
|
||||
window.$isMescrollBounce = true
|
||||
}, {passive: true})
|
||||
// 滑动中标记是否禁止bounce (如:下拉刷新时禁止)
|
||||
window.addEventListener('touchmove', function(e){
|
||||
!window.$isMescrollBounce && e.preventDefault() // 禁止bounce
|
||||
}, {passive: false})
|
||||
}
|
||||
|
||||
export default bounce;
|
Reference in New Issue
Block a user