场景出图
该框架支持场景截图事件
代码实例
typescript
<script setup lang="ts" name="场景出图">
import { hideBar } from '@/utils/generate'
import { showCode, closeCode } from '@/utils/store'
import { onMounted, onBeforeUnmount, onBeforeMount, ref } 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 shotGrid: any
const img = ref('')
const shot = () => {
if (!shotGrid) {
shotGrid = new map.Screen.ShotGrid(map.viewer)
console.log(shotGrid)
}
img.value = shotGrid.img
}
const show = () => {
const code = ``
showCode(code)
}
onBeforeUnmount(() => {
closeCode()
map && map._viewer.destroy()
})
</script>
运行效果
更多示例