注意:不是浏览器窗口禁止缩放
1.vue框架中,index.html文件head标签中加上内容
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"><script>document.addEventListener('mousewheel', function (e) {e = e || window.event;if ((e.wheelDelta && event.ctrlKey) || e.detail) {event.preventDefault();}}, {capture: false,passive: false});</script><style>html {-ms-content-zooming: none;}</style>
2.App.vue中加上
mounted() {
// 禁止双击缩放window.onload = function() {document.addEventListener('touchstart', function(event) {if (event.touches.length > 1) {event.preventDefault()}})document.addEventListener('gesturestart', function(event) {event.preventDefault()})}},
完活儿!