geo/src/App.vue

129 lines
2.6 KiB
Vue

<template>
<div id="app">
<!-- 地图模式切换按钮 -->
<div class="map-mode-selector">
<button
@click="switchMapMode('normal')"
:class="{ active: currentMode === 'normal' }"
class="mode-btn"
>
普通地图
</button>
<button
@click="switchMapMode('split')"
:class="{ active: currentMode === 'split' }"
class="mode-btn"
>
分屏对比
</button>
<button
@click="switchMapMode('wipe')"
:class="{ active: currentMode === 'wipe' }"
class="mode-btn"
>
卷帘效果
</button>
</div>
<!-- 根据模式显示不同的地图组件 -->
<TiandituMap v-if="currentMode === 'normal'" />
<SplitScreenMap v-if="currentMode === 'split'" />
<WipeEffectMap v-if="currentMode === 'wipe'" />
</div>
</template>
<script setup>
import { ref } from 'vue'
import TiandituMap from './components/TiandituMap.vue'
import SplitScreenMap from './components/SplitScreenMap.vue'
import WipeEffectMap from './components/WipeEffectMap.vue'
const currentMode = ref('normal')
const switchMapMode = (mode) => {
currentMode.value = mode
}
</script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
height: 100%;
overflow: hidden;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
width: 100vw;
height: 100vh;
overflow: hidden;
position: relative;
}
.map-mode-selector {
position: absolute;
top: 20px;
right: 120px;
z-index: 2000;
display: flex;
gap: 5px;
background: rgba(255, 255, 255, 0.95);
border-radius: 8px;
padding: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
backdrop-filter: blur(10px);
}
.mode-btn {
padding: 10px 16px;
background: transparent;
color: #333;
border: 2px solid transparent;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: all 0.3s ease;
white-space: nowrap;
}
.mode-btn:hover {
background: rgba(0, 122, 200, 0.1);
border-color: #007ac8;
color: #007ac8;
}
.mode-btn.active {
background: linear-gradient(135deg, #007ac8, #005a96);
color: white;
border-color: #005a96;
box-shadow: 0 2px 8px rgba(0, 122, 200, 0.3);
}
.mode-btn.active:hover {
background: linear-gradient(135deg, #005a96, #004070);
}
/* 响应式设计 */
@media (max-width: 768px) {
.map-mode-selector {
top: 10px;
right: 120px;
left: 10px;
justify-content: center;
}
.mode-btn {
flex: 1;
padding: 8px 12px;
font-size: 13px;
}
}
</style>