派生自 wuyushui/SewerAndRainNetwork

zhangshuaibao
2021-04-07 aae66dc025761b18306b9271625748c26524e6a2
src/components/panel/LegendPanel.vue
@@ -1,13 +1,13 @@
<template>
  <div class="legend-panel">
    <transition name="fade">
      <div :class="'legend-content map-background'" v-show="legendControl">
      <div :class="'legend-content map-background'" v-show="isShow">
        <div class="legend-content-box" v-for="(item,index) in serviceLayers" :key="index">
          <p><span>{{ item.name }}</span></p>
          <div class="map-under-line"></div>
          <ul>
            <li v-for="(ite,inde) in item.layers" :key="inde">
              <img :src='ite.legendImage' alt=''>
            <li v-for="(ite,idx) in item.layers" :key="idx">
              <img :src="ite.legendImage===undefined?'../.././assets/images/map-pages/setting.png':ite.legendImage" alt=''>
              <span>{{ ite.name }}</span>
            </li>
          </ul>
@@ -15,7 +15,7 @@
      </div>
    </transition>
    <el-tooltip :popper-class="'map-tooltip'" effect="dark" content="图例" placement="left">
      <div :class="this.legendControl?'legend-btn map-btn-active':'legend-btn map-btn-unactive'"
      <div :class="this.isShow?'legend-btn map-btn-active':'legend-btn map-btn-unactive'"
           @click="legendChange()">
        <i class="el-icon-more-outline"></i>
      </div>
@@ -38,14 +38,14 @@
  data () {
    return {
      // 控制图例 内容的 显示/隐藏
      legendControl: false,
      isShow: false,
      serviceLayers: [LayerSoilGroundWater, LayerEnvRisk, LayerAirQuality, LayerWasteSolid, LayerWasteGas, LayerWasteWater, LayerArea, LayerPk, LayerPipeLines]
    }
  },
  methods: {
    // 图标 控制内容的展示与隐藏
    legendChange () {
      this.legendControl = !this.legendControl
      this.isShow = !this.isShow
    }
  }
}