1.创建vite vue项目
2.安装cesium
npm install cesium
案例版本为1.95
3.引入
<template>
<div id="cesiumApp">
</div>
</template>
<script setup>
import {onMounted} from "vue";
import * as Cesium from 'cesium';
onMounted(()=> {
Cesium.Ion.defaultAccessToken = 'your token'
const viewer = new Cesium.Viewer('cesiumApp', {
infoBox: false,
timeline: false, //隐藏时间线
//取消默认地图的加载
baseLayerPicker: false,
})
})
</script>
<style scoped>
html, body, #cesiumApp {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
</style>