<script>
export default {
data() {
return {
map:null,
mapAnimateControl: false
};
},
mounted() {
this.initMap();
},
methods: {
initMap() {
this.map = new AMap.Map("map", {
zoom: 10,
resizeEnable: true,
pitch:80, // 地图俯仰角度,有效范围 0 度- 83 度
// center: [116.397428, 39.90923],
// layers: [new AMap.TileLayer.Satellite()],
viewMode: '3D',
lang: "zh_cn",
});
let currentCenter = this.map.getCenter();
this.map.setCenter(currentCenter);
//开启调用
this.mapAnimateControl = true
this.rotate()
},
//定义动画
rotate() {
window.requestAnimationFrame(()=>{
if(this.mapAnimateControl==true){
this.map.setRotation((this.map.getRotation()+0.02)%360);
}
this.rotate()
})
}
},
};
</script>