更新时间:2026/09/15 14:58
可通过调用CompassLayer类方法或者属性进行定位位置、显示隐藏等控制,通过点击图标可重置地图方向。
JavaScript
MapComponent({ onReady: async (err, mapController) => { if (!err) { // 获取地图的控制器类,用来操作地图 this.mapController= mapController; this.compass = this.mapController.getLayerByTag(SysEnum.LayerTag.COMPASS) as CompassLayer; this.compass.x = 64; this.compass.y = 64; }}, mapOptions: new MapOptions(null)}).width('100%').height('100%')本篇文章对您是否有帮助?