集成cesium+vite-plugin-earth

This commit is contained in:
小冰cc 2023-07-07 09:45:11 +08:00
parent 148dec61f4
commit 667c070dd6
4 changed files with 54 additions and 0 deletions

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "vite-cesium-sandbox",
"private": true,
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"cesium": "^1.107.0",
"vue": "^3.2.47"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.1.0",
"typescript": "^5.0.2",
"vite": "^4.3.9",
"vite-plugin-earth": "^2.1.2",
"vue-tsc": "^1.4.2"
}
}

19
src/App.vue Normal file
View File

@ -0,0 +1,19 @@
<script setup lang="ts">
import { onMounted } from 'vue';
import { Viewer } from 'cesium';
onMounted(() => {
const viewer = new Viewer('cesiumContainer', { infoBox: false });
console.log(viewer);
});
</script>
<template>
<div id="cesiumContainer"></div>
</template>
<style scoped>
#cesiumContainer {
width: 100%;
height: 100%;
}
</style>

5
src/main.ts Normal file
View File

@ -0,0 +1,5 @@
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
createApp(App).mount('#app')

8
vite.config.ts Normal file
View File

@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { cesiumPlugin } from 'vite-plugin-earth';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), cesiumPlugin()]
});