Skip to content

Mapbox服务

加载mapbox服务

支持影像

INFO

userName:用户名

styleId:样式id

token:token指令

代码实例

ts
<script setup lang="ts">
import { onMounted, onBeforeUnmount, onBeforeMount, reactive } from 'vue'
onBeforeMount(() => {
  hideBar()
})
const LarkExplorer = window.LarkExplorer
let map: any
onMounted(() => {
  LarkExplorer.ready({
    baseUrl: './dist/resources/',
  }).then(initMap)
})

function initMap() {
  map = new LarkExplorer.Map('map')
}

let imagery: any
const options = reactive({
  userName: '',
  styleId: '',
  token: '',
})
// 加载服务图层
const start = () => {
  remove()
  imagery = map.Layers.Imagery.addMapbox(options)
}
// 移除图层对象
const remove = () => {
  imagery && map.Layers.Imagery.remove(imagery)
  imagery = undefined
}
</script>

运行效果 更多示例