<template> <div class="partTitleHM"> 降雨特征 <div class="head-right" style=""> <div class="head-item" v-for="(item, index) in yearList" :key="item" :class="activedname == item.name ? 'activedright' : ''" @click="yearclick(item, index)" > {{ item.name }} </div> </div> </div> <div class="partContHM"> <div class="HeadContent" v-if="activedname.value == '年际降雨变化'">丰、枯年交替出现,且降雨量变化幅度大</div> <div class="HeadContent" v-else>年内降雨量分配不均匀,冬季干旱,雨雪稀少</div> <div class="box-body"> <div style="height: 100%"> <RainfallEcharts :data="chartData2" :refresh="chartData2.refresh"></RainfallEcharts> </div> </div> </div> </template> <script setup> import RainfallEcharts from '@/views/sponeScreen/Echarts/RainfallEcharts.vue'; //3d图例 const chartData2 = ref({ xAxis: [1985, 1900, 1995, 2000, 2005, 2010, 2015, 2020], yAxis: [700, 600, 750, 800, 750, 740, 780, 900], yAxis2: [7, 9, 10, 9, 11, 10, 12, 15], refresh: 1, }); const activedname = ref('年际降雨变化'); const ContentDetails = ref(''); const yearList = ref([ { name: '年际降雨变化', value: 1 }, { name: '年内降雨量', value: 2 }, ]); const a = ref(''); function yearclick(val) { console.log(val.name, 'val.name'); activedname.value = val.name; console.log(activedname.value, 'activedname.value '); } const refresh = ref(1); </script> <style lang="scss" scoped> .HeadContent { width: 100%; height: 30px; background: #2270ff; text-align: center; line-height: 30px; color: #ffffff; } .box-body { height: calc(100vh - 710px); padding-left: 5px; position: relative; overflow: auto; } .head-right { cursor: pointer; position: relative; font-size: 14px; left: 200px; top: -32px; color: #fff; display: flex; max-width: 200px; overflow: hidden; overflow-x: auto; line-height: 18px; .head-item { margin-left: 10px; padding: 2px 3px; border: 1px solid transparent; background: #013a73; height: 23px; text-align: center; min-width: 42px; } .activedright { border: 1px solid #2cfce9; color: #e4f5ff; background: #166f84; } } </style>