<template> <!-- 排水体系 --> <div class="DrainageSystem"> <!-- 中间的污水/雨水切换 --> <div class="TypeChangeBox"> <div class="TypeBtn" v-for="(item, index) in AllData.yw_type" :class="[AllData.TypeID == item.key ? 'TypeBtnCheck' : '']" @click="TypeClick(item)" > <span class="TypenName">{{ item.name }}</span> </div> </div> <YSIndex v-if="AllData.TypeID == 'rain'"></YSIndex> </div> </template> <script setup name="DrainageSystem"> import { ref, reactive, toRefs, onMounted } from "vue"; import YSIndex from "./YSIndex.vue"; const AllData = reactive({ yw_type: [ { name: "污水体系", value: "污水分区,尾水路径", key: "sewage" }, { name: "雨水体系", value: "雨水分区,雨水系统流向,雨水系统流向1,rain_water_pump_station_info,water_gate_info,storage_tank_info", key: "rain", }, ], }); const TypeClick = (item) => { AllData.TypeID = item.key; }; onMounted(() => {}); onBeforeUnmount(() => {}); </script> <style lang="scss" scoped> .DrainageSystem { .TypeChangeBox { left: 50%; position: fixed; top: 120px; width: 300px; height: 39px; margin-left: -150px; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; z-index: 10; .TypeBtn { width: 138px; height: 39px; background: url("@/assets/images/pictureOnMap/JCFX/MoRen.png") no-repeat center; float: left; cursor: pointer; .TypenName { display: inline-block; width: 138px; height: 39px; font-family: Source Han Sans CN; font-weight: bold; font-size: 16px; color: #ffffff; line-height: 36px; text-shadow: 0px 2px 8px rgba(5, 28, 55, 0.42); // background: linear-gradient( // 180deg, // rgba(49, 190, 255, 0.3) 0%, // rgba(239, 252, 254, 1) 40%, // rgba(239, 252, 254, 1) 100% // ); // background-clip: text; // -webkit-text-fill-color: transparent; text-align: center; } } .TypeBtnCheck { background: url("@/assets/images/pictureOnMap/JCFX/XuanZhong.png") no-repeat center; } } } </style>