
<script> function devicepix(){ let currentPixelRatio = window.devicePixelRatio; if (currentPixelRatio !== lastPixelRatio) { console.log('页面缩放变化了'); } lastPixelRatio = currentPixelRatio; console.log(lastPixelRatio) } let lastPixelRatio = window.devicePixelRatio; window.addEventListener('resize', devicepix); devicepix() </script>