| | |
| | | <template> |
| | | <div class="footer"> |
| | | <img |
| | | v-for="item in list" |
| | | v-for="(item,index) in list.filter(i => !i.disable)" |
| | | :class="item.className" |
| | | :src="item.active ? item.activeImg : item.img" |
| | | alt="" |
| | | @click="imgClick(item)" |
| | | @click="footAction(item,index)" |
| | | /> |
| | | </div> |
| | | <div class="intelligent-introduction-flying"> |
| | | <img class="orthophoto" src="@/assets/images/intelligent-introduction-flying.png" alt="" /> |
| | | <img |
| | | class="orthophoto" |
| | | src="@/assets/images/intelligent-introduction-flying.png" |
| | | alt="" |
| | | @click="footAction(list[5],5)" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | |
| | | import { useMapAggregation } from '@/views/Home/useMapAggregation/useMapAggregation' |
| | | import { useStore } from 'vuex' |
| | | import func from '@/utils/func' |
| | | |
| | | const store = useStore() |
| | | const footActiveIndex = computed(() => store.state.home.footActiveIndex) |
| | | |
| | | // 机巢聚合 |
| | | const { init, removeAll } = useMapAggregation('device') |
| | |
| | | |
| | | const list = ref([ |
| | | { |
| | | name: 'event1', |
| | | name: 'jc', |
| | | img: img1, |
| | | activeImg: activeImg1, |
| | | active: true, |
| | |
| | | removeAll: removeAll, |
| | | }, |
| | | { |
| | | name: 'event2', |
| | | name: 'sj', |
| | | img: img2, |
| | | activeImg: activeImg2, |
| | | active: false, |
| | |
| | | init: eventInit, |
| | | removeAll: eventRemove, |
| | | }, |
| | | { name: 'event3', img: img3, activeImg: activeImg3, active: false, className: 'panorama' }, |
| | | { name: 'event4', img: img4, activeImg: activeImg4, active: false, className: 'threeD' }, |
| | | { name: 'event5', img: img5, activeImg: activeImg5, active: false, className: 'orthophoto' }, |
| | | { name: 'qj', img: img3, activeImg: activeImg3, active: false, className: 'panorama' }, |
| | | { name: 'sw', img: img4, activeImg: activeImg4, active: false, className: 'threeD' }, |
| | | { name: 'zs', img: img5, activeImg: activeImg5, active: false, className: 'orthophoto' }, |
| | | { name: 'zyjf', active: false, disable: true }, |
| | | ]) |
| | | const store = useStore() |
| | | const imgClick = (toItem,index) => { |
| | | index !== undefined && store.commit('setFootActiveIndex',index) |
| | | const fromItem = list.value.find(item => item.active) |
| | | if (fromItem.name === toItem.name) return |
| | | |
| | | const footAction = (toItem, index) => { |
| | | const fromItem = list.value.find(item => item.active) //上一个激活item |
| | | if (fromItem.name === toItem?.name) return //是重复点击 |
| | | index !== undefined && store.commit('setFootActiveIndex', index) //是按钮点击得动作 |
| | | fromItem?.removeAll?.() |
| | | nextTick(() => { |
| | | toItem?.init?.() |
| | | }) |
| | | list.value = list.value.map(item => ({ ...item, active: item.name === toItem.name })) |
| | | nextTick(() => toItem?.init?.()) |
| | | list.value = list.value.map(item => ({ ...item, active: item.name === toItem?.name })) |
| | | } |
| | | |
| | | const footActiveIndex = computed(() => store.state.home.footActiveIndex) |
| | | watch(footActiveIndex, val => { |
| | | console.log(6666666) |
| | | imgClick(list.value[val]) |
| | | },{deep:true}) |
| | | watch( |
| | | footActiveIndex, |
| | | val => { |
| | | footAction(list.value[val]) |
| | | }, |
| | | { deep: true } |
| | | ) |
| | | |
| | | // 销毁前钩子 |
| | | onBeforeUnmount(() => { |
| | |
| | | bottom: 23px; |
| | | |
| | | img { |
| | | cursor: pointer; |
| | | width: 146px; |
| | | height: 54px; |
| | | } |