src/utils/map2.js
@@ -2481,4 +2481,24 @@ zoom: 15, duration: 1500 }) } } //监听地图双击事件 export function touchClick() { let dom = document.getElementById('openlayerContainer'); dom.addEventListener('touchstart', onTouchStart); function onTouchStart(e) { let len = e.touches.length; if (len === 2) { window.mapapi.getView().animate({ center: window.mapapi.getView().getCenter(), zoom: window.mapapi.getView().getZoom() - 1, duration: 1000, }); } } }