如果需要禁止頁面的縮放,需要在vue項目中做如下更改:
#index.html
<html lang="">
<head>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
...
</head>
...
</html>
# App.vue
<script>
window.onload = function() {
document.addEventListener('touchstart', function(event) {
if (event.touches.length > 1) {
event.preventDefault()
}
});
document.addEventListener('gesturestart', function(event) {
event.preventDefault()
})
};
...
</script>