Showing
1 changed file
with
21 additions
and
3 deletions
| 1 | <template> | 1 | <template> |
| 2 | <div class="hager-solution-index"> | 2 | <div class="hager-solution-index"> |
| 3 | - <hager-box :style="{backgroundColor: '#F5F6FB', height: top_img_height }"> | 3 | + <hager-box :style="{backgroundColor: '#F5F6FB', height: solution_box_height }"> |
| 4 | <div class="hager-solution-top"> | 4 | <div class="hager-solution-top"> |
| 5 | <el-row v-if="!is_xs" :gutter="20" style="display: flex;"> | 5 | <el-row v-if="!is_xs" :gutter="20" style="display: flex;"> |
| 6 | <el-col :span="8"> | 6 | <el-col :span="8"> |
| ... | @@ -14,10 +14,10 @@ | ... | @@ -14,10 +14,10 @@ |
| 14 | </div> | 14 | </div> |
| 15 | </el-col> | 15 | </el-col> |
| 16 | <el-col :span="16"> | 16 | <el-col :span="16"> |
| 17 | - <img :style="{ height: top_img_height, width: '100%' }" src="https://cdn.ipadbiz.cn/hager/banner/01.png"> | 17 | + <img :style="{ height: solution_box_height, width: '100%' }" src="https://cdn.ipadbiz.cn/hager/banner/01.png"> |
| 18 | </el-col> | 18 | </el-col> |
| 19 | </el-row> | 19 | </el-row> |
| 20 | - <img v-else :style="{ height: top_img_height, width: '100%' }" src="https://cdn.ipadbiz.cn/hager/banner/01.png"> | 20 | + <img v-else :style="{ height: solution_mini_height, width: '100%' }" src="https://cdn.ipadbiz.cn/hager/banner/01.png"> |
| 21 | </div> | 21 | </div> |
| 22 | </hager-box> | 22 | </hager-box> |
| 23 | <hager-box class="box-n"> | 23 | <hager-box class="box-n"> |
| ... | @@ -76,6 +76,7 @@ import hagerH1 from '@/components/common/hagerH1.vue'; | ... | @@ -76,6 +76,7 @@ import hagerH1 from '@/components/common/hagerH1.vue'; |
| 76 | import hagerMore from '@/components/hagerMore.vue'; | 76 | import hagerMore from '@/components/hagerMore.vue'; |
| 77 | import hagerService from '@/components/common/hagerService.vue'; | 77 | import hagerService from '@/components/common/hagerService.vue'; |
| 78 | import { getSolutionListAPI } from "@/api/hager.js"; | 78 | import { getSolutionListAPI } from "@/api/hager.js"; |
| 79 | +import $ from 'jquery'; | ||
| 79 | 80 | ||
| 80 | export default { | 81 | export default { |
| 81 | components: { hagerBox, hagerH1, hagerMore, hagerService }, | 82 | components: { hagerBox, hagerH1, hagerMore, hagerService }, |
| ... | @@ -114,6 +115,8 @@ export default { | ... | @@ -114,6 +115,8 @@ export default { |
| 114 | }, | 115 | }, |
| 115 | activeIndex: 0, | 116 | activeIndex: 0, |
| 116 | reach_end: false, | 117 | reach_end: false, |
| 118 | + solution_box_height: '10rem', | ||
| 119 | + solution_mini_height: '10rem', | ||
| 117 | } | 120 | } |
| 118 | }, | 121 | }, |
| 119 | async mounted () { | 122 | async mounted () { |
| ... | @@ -121,8 +124,23 @@ export default { | ... | @@ -121,8 +124,23 @@ export default { |
| 121 | if (code) { | 124 | if (code) { |
| 122 | this.solution_list = data; | 125 | this.solution_list = data; |
| 123 | } | 126 | } |
| 127 | + this.$nextTick(() => { | ||
| 128 | + // 高度监听 | ||
| 129 | + this.solution_box_height = $('.hager-solution-top').outerWidth() * 0.4 + 'px'; | ||
| 130 | + this.solution_mini_height = $('.hager-solution-top').outerWidth() * 0.6 + 'px'; | ||
| 131 | + }); | ||
| 132 | + window.addEventListener('resize', this.handleHeightResize); | ||
| 133 | + }, | ||
| 134 | + beforeDestroy() { | ||
| 135 | + // 在组件销毁前移除监听器,防止内存泄漏 | ||
| 136 | + window.removeEventListener('resize', this.handleHeightResize); | ||
| 124 | }, | 137 | }, |
| 125 | methods: { | 138 | methods: { |
| 139 | + handleHeightResize () { | ||
| 140 | + // 高度监听 | ||
| 141 | + this.solution_box_height = $('.hager-solution-top').outerWidth() * 0.4 + 'px'; | ||
| 142 | + this.solution_mini_height = $('.hager-solution-top').outerWidth() * 0.6 + 'px'; | ||
| 143 | + }, | ||
| 126 | splitListIntoChunks (list) { | 144 | splitListIntoChunks (list) { |
| 127 | const chunkSize = 4; // 每组4个项目 | 145 | const chunkSize = 4; // 每组4个项目 |
| 128 | const result = []; | 146 | const result = []; | ... | ... |
-
Please register or login to post a comment