integrated_traffic_vue/src/views/BI/components/rightico.vue

114 lines
2.5 KiB
Vue

<template>
<div class="right_options">
<div
v-for="(item, index) in data.rightOptionsList"
:key="index"
class="option"
>
<div class="tooltip">{{ item.label }}</div>
<img :src="item.check ? item.checkImg : item.img" alt="" />
</div>
</div>
</template>
<script setup>
import { reactive } from "vue";
const data = reactive({
rightOptionsList: [
{
img: new URL("/src/assets/images/map/rico1.png", import.meta.url).href,
checkImg: new URL("/src/assets/images/map/rico1_on.png", import.meta.url)
.href,
check: true,
label: "全屏",
},
{
img: new URL("/src/assets/images/map/rico2.png", import.meta.url).href,
checkImg: new URL("/src/assets/images/map/rico2_on.png", import.meta.url)
.href,
check: false,
label: "返回中心点",
},
{
img: new URL("/src/assets/images/map/rico3.png", import.meta.url).href,
checkImg: new URL("/src/assets/images/map/rico3_on.png", import.meta.url)
.href,
check: false,
label: "切换视角",
},
{
img: new URL("/src/assets/images/map/rico4.png", import.meta.url).href,
checkImg: new URL("/src/assets/images/map/rico4_on.png", import.meta.url)
.href,
check: false,
label: "纯净地图",
},
],
});
</script>
<style scoped lang="scss">
.right_options {
width: 40px;
background: rgba(21, 54, 105, 0.4);
border: 1px solid rgba(63, 145, 197, 0.3);
border-radius: 4px;
display: flex;
flex-direction: column;
.option {
cursor: pointer;
position: relative;
width: 40px;
height: 50px;
border-bottom: 1px solid rgba(63, 145, 197, 0.3);
text-align: center;
line-height: 40px;
img {
width: 30px;
height: 30px;
margin-top: 10px;
}
&:hover {
animation: slideX 0.5s;
.tooltip {
opacity: 1;
right: 80px;
}
}
&:last-child {
border-bottom: none;
}
.tooltip {
transition: 0.5s;
opacity: 0;
width: 112px;
height: 36px;
background-image: url("/src/assets/images/map/rightbg.png");
background-size: 100% 100%;
background-repeat: no-repeat;
color: #fff;
font-size: 14px;
text-align: center;
line-height: 36px;
position: absolute;
left: -125px;
top: 7px;
}
}
@keyframes slideX {
0% {
transform: translateX(0);
}
50% {
transform: translateX(0px);
}
100% {
transform: translateX(0);
}
}
}
</style>