feat: 添加工具插件
This commit is contained in:
@@ -100,6 +100,11 @@ export function useAmap(options: AMap.MapOptions = {}) {
|
||||
...options,
|
||||
})
|
||||
|
||||
// 添加缩放工具条(右上角)
|
||||
mapInstance.value.addControl(new AMap.ToolBar({
|
||||
position: 'RT',
|
||||
}))
|
||||
|
||||
return mapInstance.value
|
||||
} catch (err: any) {
|
||||
error.value = err.message || '地图初始化失败'
|
||||
|
||||
@@ -23,4 +23,5 @@ export const AMAP_PLUGINS = [
|
||||
'AMap.Geolocation', // 定位
|
||||
'AMap.MarkerClusterer', // 点聚合
|
||||
'AMap.Driving', // 驾车路线规划
|
||||
'AMap.ToolBar', // 缩放工具条
|
||||
] as const
|
||||
|
||||
Reference in New Issue
Block a user