适配 (取消默认事件)
export default function setupDocumentEvent() {
// 禁止 ios 缩放屏幕
document.addEventListener('gesturestart', function (event) {
event.preventDefault();
});
// 禁止移动端(IOS)双击页面变大
let touchTime = 0;
document.addEventListener('touchstart', function (event) {
if (event.touches.length > 1) {
event.preventDefault();
}
});
document.addEventListener(
'touchend',
function (event) {
//记录当前点击的时间与下一次时间的间隔
const nowTime = new Date();
if (nowTime.getTime() - touchTime <= 300) {
event.preventDefault();
}
touchTime = nowTime.getTime();
},
false
);
}