Files
gd-earth/src/components/HotLandmark.vue

113 lines
2.2 KiB
Vue
Raw Normal View History

2024-02-20 14:55:52 +08:00
<template>
<div>
<div
v-show="!showit"
class="switch"
2026-03-18 16:29:28 +08:00
style="position: absolute; top: -2.5rem; right: 0; z-index: 99; cursor: pointer"
@click="showLandmark"
>
<img class="icon" src="../assets/up.png" />
</div>
<div
v-show="showit"
class="switch"
2026-03-18 16:29:28 +08:00
style="position: absolute; top: -2.5rem; right: 0; z-index: 99; cursor: pointer"
@click="showLandmark"
>
<img class="icon" src="../assets/down.png" />
</div>
<div class="landmark">
<table v-if="showit">
<thead>
<tr>
<th>景点名称</th>
<th>经度</th>
<th>纬度</th>
<th>访问景点</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in landmarkArr" :key="index">
<td>{{ item ? item.landmark : index + 1 }}</td>
<td>{{ item ? item.position.lng : "" }}</td>
<td>{{ item ? item.position.lat : "" }}</td>
<td>
<button style="cursor: pointer" @click="write(item.position)">访问</button>
</td>
</tr>
</tbody>
</table>
</div>
2024-02-20 14:55:52 +08:00
</div>
</template>
<script setup>
import { ref } from "vue";
import { useFlytoStore } from "/@/stores/flyto";
import { landmarkArr } from "/@/information/landmark";
2024-02-20 14:55:52 +08:00
let showit = ref(false);
const showLandmark = () => {
showit.value = !showit.value;
};
2024-02-20 14:55:52 +08:00
const flyto = useFlytoStore();
2024-02-20 14:55:52 +08:00
const write = (flytoLand) => {
flyto.set(flytoLand);
};
2024-02-20 14:55:52 +08:00
</script>
<style scoped>
.landmark {
2026-03-18 16:29:28 +08:00
max-height: 18rem;
overflow-y: auto;
2024-02-20 14:55:52 +08:00
}
.switch {
2026-03-18 16:29:28 +08:00
width: 2.5rem;
height: 2.5rem;
2024-02-20 14:55:52 +08:00
border-radius: 50%;
}
.icon {
2026-03-18 16:29:28 +08:00
width: 2.5rem;
2024-02-20 14:55:52 +08:00
}
table {
color: #ffffff;
2024-02-20 14:55:52 +08:00
background-color: #242424;
2026-03-18 16:29:28 +08:00
padding: 0.5rem;
border-radius: 0.5rem;
2024-02-20 14:55:52 +08:00
border-collapse: separate;
2026-03-18 16:29:28 +08:00
border-spacing: 0.1rem;
text-align: center;
2024-02-20 14:55:52 +08:00
}
table th:first-child {
2026-03-18 16:29:28 +08:00
width: 6rem;
2024-02-20 14:55:52 +08:00
}
table th:not(:first-child) {
2026-03-18 16:29:28 +08:00
width: 5rem;
2024-02-20 14:55:52 +08:00
}
table thead tr {
background-color: rgba(84, 84, 84, 0.8);
}
table tbody tr:nth-child(even) {
background-color: rgba(84, 84, 84, 0.8);
}
table tbody tr:nth-child(odd) {
background-color: rgba(84, 84, 84, 0.25);
}
table th,
table td {
2026-03-18 16:29:28 +08:00
padding: 0.2rem 0.2rem;
2024-02-20 14:55:52 +08:00
}
</style>