From 09c4a4cdb8f9710b93a9daff83575d05c0f9be6b Mon Sep 17 00:00:00 2001 From: yangdelong <828900aaa> Date: 星期三, 07 四月 2021 15:11:40 +0800 Subject: [PATCH] 增加图例默认图标 --- src/components/panel/LegendPanel.vue | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/panel/LegendPanel.vue b/src/components/panel/LegendPanel.vue index fe6d347..3c7178e 100644 --- a/src/components/panel/LegendPanel.vue +++ b/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,21 @@ data () { return { // 鎺у埗鍥句緥 鍐呭鐨� 鏄剧ず/闅愯棌 - legendControl: false, + isShow: false, serviceLayers: [LayerSoilGroundWater, LayerEnvRisk, LayerAirQuality, LayerWasteSolid, LayerWasteGas, LayerWasteWater, LayerArea, LayerPk, LayerPipeLines] } }, methods: { // 鍥炬爣 鎺у埗鍐呭鐨勫睍绀轰笌闅愯棌 legendChange () { - this.legendControl = !this.legendControl + console.log(this.serviceLayers) + this.serviceLayers.forEach((item) => { + item.layers.forEach((itm) => { + console.log(itm.legendImage) + }) + }) + debugger + this.isShow = !this.isShow } } } -- Gitblit v1.8.0