Closed FirokOtaku closed 1 year ago
调用 map.addLayer(layer) API 返回的 Promise 对象永远不会被 resolve 或 reject.
map.addLayer(layer)
resolve
reject
最小复现代码:
<style scoped> </style> <template> <div> <div id="mars3dContainer" class="mars3d-container"></div> </div> </template> <script setup> import {markRaw, onMounted, onUnmounted} from 'vue' // 引入cesium基础库 import 'mars3d-cesium/Build/Cesium/Widgets/widgets.css' import * as Cesium from 'mars3d-cesium' // 导入mars3d主库 import 'mars3d/dist/mars3d.css' import * as mars3d from 'mars3d' let Map = null onMounted(async () => { let map = new mars3d.Map('mars3dContainer') Map = markRaw(map) let layer = new mars3d.layer.GraphicLayer() console.log('开始添加图层') let result = await map.addLayer(layer) console.log('完成添加图层') }) onUnmounted(() => { Map.destroy() Map = null }) </script>
测试时, 后续的 console.log 调用永远不会执行.
console.log
GraphicLayer的Promise的是未触发,将在v3.5.2版本修复
调用
map.addLayer(layer)
API 返回的 Promise 对象永远不会被resolve
或reject
.最小复现代码:
测试时, 后续的
console.log
调用永远不会执行.