From 6bce1997cef9a58142258c0e12828f76d05762b1 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期一, 08 三月 2021 14:49:40 +0800 Subject: [PATCH] 菜单组件联动 --- src/components/panel/RightSearchPanel.vue | 37 +++++++++++-------------------------- 1 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/components/panel/RightSearchPanel.vue b/src/components/panel/RightSearchPanel.vue index 9462fe7..4976bac 100644 --- a/src/components/panel/RightSearchPanel.vue +++ b/src/components/panel/RightSearchPanel.vue @@ -1,7 +1,7 @@ <template> <div id="right-panel"> <div class="panel-tab"> - <div v-for="item in topicMenu" :key="item.id" :title="item.name" class="tab-item" @click="handleGd" :class="{'B-TMT-tab-waybill-isActive': isWaybillHover}"> + <div v-for="item in topicMenu" :key="item.id" :title="item.name" class="tab-item" @click="handleClick(item)"> <img :src="item.icon" style="width: 24px;height: 24px;"></div> <!-- <div class="tab-item" @click="handleHb" :class="{'B-TMT-tab-route-isActive': isRouteHover}"></div>--> @@ -20,21 +20,16 @@ <script> import $ from 'jquery' -import EnvProtectSearch from './topicSearch/EnvProtectSearch' -import DischargeSearch from './topicSearch/DischargeSearch' -import { TopicList } from '../../conf/Topic' - -import SewersSearch from '@components/panel/topicSearch/SewersSearch' +import { TopicComp, TopicList } from '../../conf/Topic' export default { name: 'MonitorPanel', - components: { EnvProtectSearch, DischargeSearch }, + components: TopicComp, data () { return { - topicMenu: [], topicList: TopicList, topicCheckedList: [], isPanelVisible: false, - gcComp: SewersSearch, + gcComp: 'sewersSearch', gdVisible: true, hbVisible: false, @@ -45,21 +40,10 @@ } }, - computed: {}, - watch: { - '$store.state.map.topic.topicCheckedList': function (newVal, oldVal) { - console.log(oldVal) - console.log(newVal) - this.topicCheckedList = newVal - this.topicMenu = [] - this.topicList.forEach((item) => { - this.topicCheckedList.forEach((itm) => { - if (item.name === itm) { - // item.checked = tr - this.topicMenu.push(item) - } - }) - }) + computed: { + topicMenu () { + console.log(this.$store.state.map.topic.topicCheckedList) + return this.$store.state.map.topic.topicCheckedList } }, methods: { @@ -69,8 +53,9 @@ handlePage (page) { }, - handleGd () { - this.title = '绠¢亾淇℃伅鏌ヨ' + handleClick (item) { + this.title = item.name + this.gcComp = item.comp }, toggleMonitorPanel () { const el = $('.btn-stretch') -- Gitblit v1.8.0