本质就是两个地图容器使用相同的view
const view = new View({
center: fromLonLat([117.283042, 31.86119]),
projection: 'EPSG:3857',
zoom: 7,
maxZoom: 20,
constrainResolution: true
})
new Map({
target: 'ol-map-left',
layers: [
new Tile({
source: new TileArcGISRest({
url: 'xxxxxxxxxxxxxxxxxxx'
})
})
],
view
})
new Map({
target: 'ol-map-right',
layers: [
new Tile({
source: new TileArcGISRest({
url: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
})
})
],
view
})