<script setup>
import {onMounted, ref} from 'vue'
import * as Cesium from 'cesium'
onMounted(() => {
const viewer = new Cesium.Viewer('cesiumContainer', {})
var tileset = new Cesium.Cesium3DTileset({
url: "../public/mars3d-max-shihua-3dtiles-master/tileset.json",
});
viewer.scene.primitives.add(tileset);
tileset.readyPromise.then(() => viewer.flyTo(tileset));
})
</script>
<template>
<div id="cesiumContainer"></div>
</template>
<style scoped>
#cesiumContainer {
width: 100vw;
height: 100vh;
}
</style>
报错:Uncaught TypeError: Cannot read properties of undefined (reading 'then')
文件位于App.vue
新人上路,请大佬不吝赐教!
看一下这个PR里面的示例? 👉 Deprecate ready promises by ggetz · Pull Request #11059 · CesiumGS/cesium