Skip to content

场景触发事件(渲染后)

代码实例

typescript
<script setup lang="ts">
import { onMounted, onBeforeUnmount, onBeforeMount } 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')
  console.log(map)
}

let postRender: any
const start = () => {
  const listener = () => {
    console.log('我是每次场景渲染后触发的事件')
  }
  postRender = map.Render.PostRender.addEventListener(listener)
}

const stop = () => {
  postRender && postRender()
}
</script>

运行效果 更多示例