From acc0e16e18a96a72a951fb11270dbb4bf465b35f Mon Sep 17 00:00:00 2001 From: longyvfengyun <496960745@qq.com> Date: 星期二, 20 六月 2023 16:10:21 +0800 Subject: [PATCH] 内容修改 --- src/views/home/index.vue | 86 ++++++++++--------------------------------- 1 files changed, 20 insertions(+), 66 deletions(-) diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 49b6ab6..aa8325e 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,31 +1,26 @@ <script setup> -import FlexLayout from "@/components/FlexLayout.vue"; import CardBox from "@/components/CardBox.vue"; -import {onMounted, onUnmounted, ref, watch} from "vue"; +import {onMounted, onUnmounted, watch} from "vue"; import MapPin from "@/components/MapPin.vue"; import slideMenu from "@/views/mainLayout/js/slideMenu"; +import homeContentModule from "@/views/home/js/homeContentModule"; +import homeInfoModule from "@/views/home/js/homeInfoModule"; +import {Setting} from "@element-plus/icons-vue"; -const {isCollapse} = slideMenu(); -const homeInfo = ref([]); -for(let i=1; i<10; i++) { - homeInfo.value.push({ - name: "#"+i+"瀹�", - temp: 32, - hum: 7, - diffPre: 1 - }); -} +const { + isCollapse +} = slideMenu(); -const homeContentDom = ref(null); -const cWidth = ref(0); -const cHeight = ref(0); -const dWidth = ref(1279); -const dHeight = ref(649); +const { + homeContentDom, + cWidth, cHeight, + dWidth, dHeight, + setContainerSize +} = homeContentModule(); -const setContainerSize = ()=>{ - cWidth.value = homeContentDom.value.offsetWidth; - cHeight.value = homeContentDom.value.offsetHeight; -} +const {homeInfo} = homeInfoModule(); + +homeInfo[0].hum = 123; watch(isCollapse, ()=>{ setTimeout(()=>{ @@ -49,43 +44,13 @@ <template> <div class="home-content" ref="homeContentDom"> <map-pin - name="鏁版嵁鏈烘埧" + v-for="(item, index) in homeInfo" :key="'key'+index" + :name="item.name" :c-width="cWidth" :c-height="cHeight" :d-width="dWidth" :d-height="dHeight" - :x="0" :y="0"></map-pin> - <map-pin - name="鏁版嵁鏈烘埧" - :c-width="cWidth" :c-height="cHeight" - :d-width="dWidth" :d-height="dHeight" - :x="446" :y="355"></map-pin> - <map-pin - name="鍩瑰吇闂�" - :c-width="cWidth" :c-height="cHeight" - :d-width="dWidth" :d-height="dHeight" - :x="555" :y="385"></map-pin> - <map-pin - name="娴嬪簭闂�" - :c-width="cWidth" :c-height="cHeight" - :d-width="dWidth" :d-height="dHeight" - :x="765" :y="450"></map-pin> + :x="item.pos.x" :y="item.pos.y"></map-pin> <div class="card-box-list"> - <div - class="card-box-item" - v-for="(item, index) in homeInfo" :key="'key'+index"> - <card-box> - <div class="home-info-list"> - <div class="home-info-item"> - {{ item.name }}娓╁害锛歿{ item.temp }} - </div> - <div class="home-info-item"> - {{ item.name }}婀垮害锛歿{ item.hum }} - </div> - <div class="home-info-item"> - {{ item.name }}鍘嬪樊锛歿{ item.diffPre }} - </div> - </div> - </card-box> - </div> + </div> </div> </template> @@ -97,16 +62,5 @@ background-image: url("./images/home.png"); background-repeat: no-repeat; background-size: 100% 100%; -} -.card-box-list { - text-align: center; - .card-box-item { - display: inline-block; - margin-left: 16px; - } -} - -.home-info-list { - padding: 8px; } </style> -- Gitblit v1.9.1