From 02ab30d63948e13b21339a0bdbab7dc516d451bb Mon Sep 17 00:00:00 2001 From: zhangshuaibao <15731629597@163.com> Date: 星期三, 17 三月 2021 17:59:23 +0800 Subject: [PATCH] 完善左上角工具栏的点击问题 --- src/components/panel/ToolBoxPanel.vue | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/panel/ToolBoxPanel.vue b/src/components/panel/ToolBoxPanel.vue index 8d942da..9b9a409 100644 --- a/src/components/panel/ToolBoxPanel.vue +++ b/src/components/panel/ToolBoxPanel.vue @@ -20,13 +20,13 @@ > <el-button slot="reference" class="el-button" :class="active === index ? 'tools-panel-choose':''" @click="changeChoose(index)"> - <img :src="item.iconSelecd" alt="" v-if="active === index"/> + <img :src="item.iconSelecd" alt="" v-if="active === index && checked === true"/> <img :src="item.icon" alt="" v-else/> <span>{{ item.label }}</span> </el-button> <el-button v-for="(itemT,indexT) in item.items" :key="indexT" @click="choiceItem(itemT,indexT)" v-show="item.index!=='2'"> - <img :src="itemT.iconChoose" :title="itemT.title" v-if="Selecd === indexT"/> + <img :src="itemT.iconChoose" :title="itemT.title" v-if="Selecd === indexT && checked === true"/> <img :src="itemT.icon" :title="itemT.title" v-else/> </el-button> <div class="base-map-inner-panel" v-show="!isShow&&item.index==='2'"> @@ -92,6 +92,8 @@ name: 'ToolBoxPanel', data () { return { + checked: false, + checkbuuton: -1, isShow: true, currentBaseMapCode: 'tianditu_img', basemapList: [], @@ -287,6 +289,16 @@ if (this.drawLayer == null) { this.drawLayer = this.L.layerGroup().addTo(this.map) } + if (this.checkbuuton === index) { + this.checked = !this.checked + } else { + if (this.checkbuuton === -1) { + this.checked = !this.checked + } else { + this.checked = true + } + } + this.checkbuuton = index }, choiceItem (itemT, indexT) { this.Selecd = indexT @@ -374,6 +386,7 @@ changeSelect () { this.selectGroup = !this.selectGroup this.isShow = !this.isShow + this.checked = false } } } -- Gitblit v1.8.0