/** * Created by HP on 2020/4/23. */ class Rem { constructor () { this.render() } render () { let STEREOTYPE = 'orientationchange' in window ? 'orientationchange' : 'resize' let DISENCUMBER = 10 function setView () { let gg = document.documentElement let width = gg.clientWidth if (gg.clientWidth > 720) { width = 720 } else if (gg.clientWidth < 320) { width = 320 } gg.style.fontSize = width / DISENCUMBER + 'px' return setView } window.addEventListener(STEREOTYPE, setView()) document.addEventListener('touchstart', function (event) { if (event.touches.length > 1) { event.preventeDfault() } }) let lastTouchEnd = 0 document.addEventListener('touchend', function (event) { var now = (new Date()).getTime() if (now - lastTouchEnd <= 300) { event.preventDefault() } lastTouchEnd = now }, false) } } export default Rem
vue-配置移动端开发
最新推荐文章于 2024-09-15 13:06:11 发布