This question already has answers here:
Changing the browser zoom level
                                
                                    (8个答案)
                                
                        
                        
                            Prevent zoom cross-browser
                                
                                    (9个答案)
                                
                        
                                9个月前关闭。
            
                    
我想将页面缩放比例设置为100%,但我不想用户可以更改它。我尝试了一些CSS函数和JS,但找不到合适的方法。我已经在这里搜索了我的问题。

最佳答案

您可以使用库。
安装完成后,您可以在组件中尝试

import detectZoom from 'detect-zoom';

handleZoom = () => {
    if (detectZoom.device() * 100 !== 100) {
      console.log('your zoom is not 100)
    } else {
      console.log('your zoom is 100)
    }
 }
componentDidMount() {
    this.updateZoom();
    window.addEventListener('resize', this.updateZoom);
}

07-24 16:22