<template> <!-- 海绵综合一张图图例 --> <div class="lengendPage"> <!-- 图例框 --> <div class="publicLegend"> <div class="legendTitle"> <div class="legendName">图层控制</div> </div> <div class="legendContent"> <div v-for="item in legendList" :key="item.layername" style="width: 100%"> <div class="titleB" @click="changeAllLegend(item)"> <div class="iconImg"> <el-icon v-if="item.isCheck" size="22"> <Check /> </el-icon> </div> {{ item.title }} </div> <div class="legendItemContent"> <div class="part" v-for="item2 in item.children" @click="changeLegend(item2)"> <div class="partItem" v-for="item3 in item2" @click="changeLegend(item3)"> <div class="iconImg"> <el-icon v-if="item3.isCheck" size="15"> <Check /> </el-icon> </div> <img :src="getImageUrl(item3.url, 'cesiumMap/legendIcon')" class="img" /> <p class="title">{{ item3.name }}</p> </div> </div> </div> </div> </div> </div> </div> </template> <script setup> import { getImageUrl } from '@/utils/ruoyi'; import cesiumMapLegend from './cesiumMapLegend.js'; const { proxy } = getCurrentInstance(); const legendList = ref([]); const ifExpand = ref(true); // 展开收起 const changeZhan = () => { ifExpand.value = !ifExpand.value; }; onMounted(() => { legendList.value = cesiumMapLegend; }); </script> <style lang="scss"> .lengendPage { position: absolute; left: 500px; bottom: 60px; z-index: 205; .publicLegend { width: 347px; height: 654px; background: #003b6d; border: 1px solid #6acefe; opacity: 0.8; .legendTitle { width: 345px; height: 46px; position: absolute; top: 1px; background: url('@/assets/cesiumMap/legendIcon/legendTitle_img.png'); .legendName { margin: 10px 255px 15px 9px; font-family: YouSheBiaoTiHei; font-weight: 400; font-size: 22px; color: #e4f5ff; } } .legendContent { position: absolute; width: 345px; top: 47px; .titleB { margin-top: 20px; margin-bottom: 20px; display: flex; height: 17px; font-family: Source Han Sans CN; font-weight: 500; font-size: 16px; color: #3afff8; .iconImg { margin-top: 3px; margin-left: 21px; margin-right: 10px; width: 16px; height: 16px; border: 2px solid #41f4ee; .el-icon { font-weight: bold; &.active { color: #41f4ee; } } } } .legendItemContent { width: 100%; .part { width: 100%; display: flex; height: 30px; align-items: center; cursor: pointer; .partItem { margin-left: 47px; display: flex; width: 180px; &:hover { background: #08596a; } .img { width: 16px; height: 16px; margin-left: 10px; margin-right: 5px; } .title { font-family: Source Han Sans CN; font-weight: 500; font-size: 14px; color: #b8ecff; } .iconImg { width: 16px; height: 16px; border: 1px solid #a6daf0; .el-icon { font-weight: bold; &.active { color: #00ee6f; } } } } } } } } } </style>