feat: 高德地图新增属性

This commit is contained in:
蒋承 2022-10-19 10:21:48 +08:00
parent ab8f5d123b
commit e89dc9d0e7
3 changed files with 54 additions and 5 deletions

View File

@ -12,6 +12,9 @@ export const option = {
amapLon: 116.39,
amapLat: 40.91,
amapZindex: 10,
viewMode: '2D',
pitch: 60,
skyColor: '#53A9DE',
lang: 'zh_cn',
features: ['bg', 'point', 'road', 'building']
}

View File

@ -44,6 +44,29 @@
<n-input-number v-model:value="optionData.amapZindex" size="small"></n-input-number>
</setting-item>
</setting-item-box>
<setting-item-box name="展示模式" :alone="true">
<setting-item>
<n-radio-group v-model:value="optionData.viewMode" name="radiogroup">
<n-space>
<n-radio v-for="song in viewModeOptions" :key="song.value" :value="song.value">
{{ song.label }}
</n-radio>
</n-space>
</n-radio-group>
</setting-item>
</setting-item-box>
<template v-if="optionData.viewMode === '3D'">
<setting-item-box name="天空色" :alone="true">
<setting-item>
<n-color-picker size="small" :modes="['hex']" v-model:value="optionData.skyColor"></n-color-picker>
</setting-item>
</setting-item-box>
<setting-item-box name="俯仰角" :alone="true">
<setting-item>
<n-input-number v-model:value="optionData.pitch" :min="0" :max="83" size="small"></n-input-number>
</setting-item>
</setting-item-box>
</template>
</collapse-item>
</template>
@ -71,6 +94,16 @@ const langOptions = ref([
label: '中英文对照'
}
])
const viewModeOptions = ref([
{
value: '2D',
label: '2D'
},
{
value: '3D',
label: '3D'
}
])
const featuresOptions = ref([
{
value: 'bg',

View File

@ -14,16 +14,26 @@ const props = defineProps({
required: true
}
})
let { amapKey, amapStyleKey, amapLon, amapLat, amapZindex, lang, amapStyleKeyCustom, features } = toRefs(
props.chartConfig.option
)
let {
amapKey,
amapStyleKey,
amapLon,
amapLat,
amapZindex,
lang,
amapStyleKeyCustom,
features,
viewMode,
pitch,
skyColor
} = toRefs(props.chartConfig.option)
let map = shallowRef(null)
const ininMap = () => {
AMapLoader.load({
key: amapKey.value, //apikey--public使
version: '1.4.4', // JSAPI 1.4.15
version: '1.4.8', // JSAPI 1.4.15
plugins: ['AMap.PlaceSearch', 'AMap.AutoComplete'] // 使
})
.then(AMap => {
@ -33,7 +43,10 @@ const ininMap = () => {
center: [amapLon.value, amapLat.value],
mapStyle: `amap://styles/${amapStyleKeyCustom.value !== '' ? amapStyleKeyCustom.value : amapStyleKey.value}`, //
lang: lang.value,
features: features.value
features: features.value,
pitch: pitch.value, // 0 - 83
skyColor: skyColor.value,
viewMode: viewMode.value, //
})
})
.catch(e => {})