|
|
@ -4,14 +4,14 @@ |
|
|
|
<AMapContainer v-if="delayLoad" style="z-index: 9;" /> |
|
|
|
</div> |
|
|
|
<div class="right border"> |
|
|
|
<div :class="['item', { active: active === item.key }]" v-for="item in operation" :key="item.key" |
|
|
|
<div :class="['item', { active: isActive(item) }]" v-for="item in operation" :key="item.key" |
|
|
|
@click="handleClick(item)"> |
|
|
|
<ElPopover :disabled="item.key !== 'weather'" trigger="hover" placement="left"> |
|
|
|
<ElPopover trigger="manual" :value="isActive(item)" :disabled="item.key !== 'weather'" placement="left"> |
|
|
|
<div v-if="item.key === 'weather'"> |
|
|
|
天气:晴 能见度:优 风向:西南 风力:1级 |
|
|
|
</div> |
|
|
|
<div class="label" slot="reference" |
|
|
|
:style="{ backgroundImage: `url(${require(`./images/${item.key}${active === item.key ? '-active' : ''}.svg`)})` }" /> |
|
|
|
:style="{ backgroundImage: `url(${require(`./images/${item.key}${isActive(item) ? '-active' : ''}.svg`)})` }" /> |
|
|
|
</ElPopover> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -32,7 +32,7 @@ export default { |
|
|
|
mixins: [provideMixin], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
active: "weather", |
|
|
|
active: [], |
|
|
|
operation: [ |
|
|
|
{ |
|
|
|
key: 'weather', |
|
|
@ -62,9 +62,17 @@ export default { |
|
|
|
delayLoad: false |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
isActive() { |
|
|
|
return item => this.active.includes(item.key) |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
handleClick(item) { |
|
|
|
this.active = item.key |
|
|
|
const findIndex = this.active.indexOf(item.key); |
|
|
|
if (findIndex === -1) this.active.push(item.key); |
|
|
|
else |
|
|
|
this.active.splice(findIndex, 1) |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|