<template>
|
<div class="top_btn">
|
<div class="menu_Box">
|
<div
|
class="first_Menu"
|
:title="item.name"
|
v-for="(item, i) in menuOptions"
|
:key="i"
|
@click="setMenuClick(item)"
|
>
|
<div class="First_img">
|
<img
|
class="imgIcon"
|
:src="require('../assets/img/topBtn/' + item.imgUrl)"
|
/>
|
</div>
|
<div class="menu_second">
|
<div
|
class="upTop"
|
v-show="item.children &&item.children.length>0 "
|
>
|
<div class="upimg"></div>
|
</div>
|
<div class="second_Box">
|
<div
|
class="second_Menu"
|
:title="res.name"
|
v-for="(res, j) in item.children"
|
:key="j"
|
@click="setMenuClick(res)"
|
:class="{ second_Menu_click: checkFlag == res.id }"
|
>
|
<img
|
class="imgIcon"
|
style="margin-bottom: 5px"
|
:src="require('../assets/img/topBtn/' + res.imgUrl)"
|
/>
|
<div class="name_box">
|
{{ res.name }}
|
</div>
|
</div>
|
</div>
|
</div>
|
<!-- <div
|
class="menu_second"
|
v-if="item.children && item.children.length > 0"
|
v-show="menuFlag == item.id"
|
>
|
<div class="upTop">
|
<div class="upimg"></div>
|
</div>
|
<div class="second_Box">
|
<div
|
class="second_Menu"
|
:title="res.name"
|
v-for="(res, j) in item.children"
|
:key="j"
|
@click="setMenuClick(res)"
|
:class="{ second_Menu_click: checkFlag == res.id }"
|
>
|
<img
|
class="imgIcon"
|
style="margin-bottom: 5px"
|
:src="require('../assets/img/topBtn/' + res.imgUrl)"
|
/>
|
<div class="name_box">
|
{{ res.name }}
|
</div>
|
</div>
|
</div>
|
</div> -->
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script lang="ts" setup>
|
import {
|
ref,
|
onMounted,
|
onBeforeUnmount,
|
reactive,
|
defineProps,
|
defineEmits,
|
} from "vue";
|
import menuData from "@/assets/js/Map/menuData.js";
|
import menuTool from "@/assets/js/Map/menuTool.js";
|
const menuFlag = ref(null);
|
const menuOptions = ref([]);
|
const checkFlag = ref(null);
|
let checkArr = ref([]);
|
const setMenuClick = (res) => {
|
if (res.children) {
|
if (menuFlag.value && menuFlag.value == res.id) {
|
menuFlag.value = null;
|
checkFlag.value = null;
|
} else {
|
menuFlag.value = res.id;
|
}
|
} else {
|
if (res.level == 1) {
|
checkFlag.value = null;
|
// console.log(res);
|
if (res.name == "清除") {
|
menuTool.clearALL(checkArr);
|
}
|
} else if (res.level == 2) {
|
checkFlag.value = res.id;
|
checkArr.value.push(res.id);
|
}
|
menuFlag.value = null;
|
menuTool.topTools(res);
|
}
|
};
|
onMounted(() => {
|
menuOptions.value = menuData.topMenu;
|
});
|
</script>
|
|
<style lang="less" scoped>
|
.top_btn {
|
position: absolute;
|
top: 23px;
|
right: 0px;
|
display: flex;
|
cursor: pointer;
|
.menu_Box {
|
margin-right: 104px;
|
display: flex;
|
.imgIcon {
|
width: 30px;
|
height: 30px;
|
}
|
.first_Menu {
|
width: 50px;
|
height: 50px;
|
margin-right: 7px;
|
background: url("../assets/img/topBtn/图标bj.png") no-repeat;
|
background-size: 100% 100%;
|
opacity: 0.8;
|
.First_img {
|
width: 100%;
|
height: 100%;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
opacity: 1;
|
}
|
}
|
|
.upTop {
|
width: 100%;
|
height: 10px;
|
display: flex;
|
justify-content: center;
|
.upimg {
|
width: 15px;
|
height: 100%;
|
background: url("../assets/img/topBtn/向上1.png") no-repeat;
|
}
|
}
|
.menu_second {
|
display: none;
|
}
|
.second_Box {
|
min-width: 50px;
|
background: #07080e;
|
box-shadow: inset 0px 0px 15px 0px rgb(38, 47, 71, 0.68);
|
|
.second_Menu {
|
min-width: 50px;
|
background: #07080e;
|
box-shadow: inset 0px 0px 8px 0px rgb(38, 47, 71, 0.68);
|
margin-top: 1px;
|
font-size: 12px;
|
font-family: Source Han Sans CN;
|
padding: 10px 10px;
|
font-weight: 300;
|
color: #d1e0ff;
|
// display: flex;
|
text-align: center;
|
.name_box {
|
line-height: 7px;
|
white-space: nowrap;
|
}
|
}
|
|
.second_Menu_click {
|
background: #171e2e;
|
border: 1px solid;
|
border-image: linear-gradient(47deg, #397bc9, #77a5cd, #397bc9) 1 1;
|
box-shadow: 0px 0px 6px 0px #080c13,
|
0px 7px 8px 0px rgba(38, 47, 71, 0.68);
|
}
|
}
|
.first_Menu:hover .menu_second {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
margin-top: 0px;
|
}
|
}
|
}
|
</style>
|