Showing
1 changed file
with
44 additions
and
1 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-09-26 13:42:11 | 2 | * @Date: 2024-09-26 13:42:11 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-17 11:21:45 | 4 | + * @LastEditTime: 2024-10-17 12:27:11 |
| 5 | * @FilePath: /hager/src/components/common/hagerHeader.vue | 5 | * @FilePath: /hager/src/components/common/hagerHeader.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -274,6 +274,14 @@ export default { | ... | @@ -274,6 +274,14 @@ export default { |
| 274 | desc: '探索配电新境界,我们的产品引领行业潮流,提供高效、安全的配电解决方案,助您事业更上一层楼!', | 274 | desc: '探索配电新境界,我们的产品引领行业潮流,提供高效、安全的配电解决方案,助您事业更上一层楼!', |
| 275 | product: [] | 275 | product: [] |
| 276 | } | 276 | } |
| 277 | + }, { | ||
| 278 | + name: '能源管理', | ||
| 279 | + icon: 'https://cdn.ipadbiz.cn/hager/icon/%E6%99%BA%E8%83%BD%E6%8E%A7%E5%88%B6@2x.png', | ||
| 280 | + info: { | ||
| 281 | + name: '智能控制', | ||
| 282 | + desc: '探索配电新境界,我们的产品引领行业潮流,提供高效、安全的配电解决方案,助您事业更上一层楼!', | ||
| 283 | + product: [] | ||
| 284 | + } | ||
| 277 | }], | 285 | }], |
| 278 | product_info: {}, | 286 | product_info: {}, |
| 279 | is_active: '', | 287 | is_active: '', |
| ... | @@ -354,6 +362,40 @@ export default { | ... | @@ -354,6 +362,40 @@ export default { |
| 354 | onClickProduct() { | 362 | onClickProduct() { |
| 355 | // 当鼠标悬停时 | 363 | // 当鼠标悬停时 |
| 356 | this.show = true; | 364 | this.show = true; |
| 365 | + // 处理菜单高度被挡住的问题 | ||
| 366 | + function isElementVisible($element) { | ||
| 367 | + var windowHeight = $(window).height(); // 获取窗口高度 | ||
| 368 | + var windowScrollTop = $(window).scrollTop(); // 获取窗口的滚动高度 | ||
| 369 | + | ||
| 370 | + var elementOffsetTop = $element.offset().top; // 获取元素的顶部偏移 | ||
| 371 | + var elementHeight = $element.outerHeight(); // 获取元素高度 | ||
| 372 | + | ||
| 373 | + // 判断元素是否完全在可视区域内 | ||
| 374 | + if (elementOffsetTop >= windowScrollTop && | ||
| 375 | + elementOffsetTop + elementHeight <= windowScrollTop + windowHeight) { | ||
| 376 | + return true; // 元素完全可见 | ||
| 377 | + } else if (elementOffsetTop < windowScrollTop || | ||
| 378 | + elementOffsetTop + elementHeight > windowScrollTop + windowHeight) { | ||
| 379 | + return false; // 元素被挡住或部分被遮挡 | ||
| 380 | + } | ||
| 381 | + } | ||
| 382 | + var $productRightWrapper = $('.product-right-wrapper'); | ||
| 383 | + | ||
| 384 | + if (isElementVisible($productRightWrapper)) { | ||
| 385 | + console.log(".product-right-wrapper 完全可见"); | ||
| 386 | + } else { | ||
| 387 | + console.log(".product-right-wrapper 被部分或完全遮挡"); | ||
| 388 | + this.$nextTick(() => { | ||
| 389 | + const productRightWrapper = document.querySelector('.product-right-wrapper'); | ||
| 390 | + // 获取窗口的高度 | ||
| 391 | + const windowHeight = $(window).height(); | ||
| 392 | + // 计算适合的高度,假设元素的 top 值固定,调整高度为可用高度 | ||
| 393 | + const topOffset = $('.product-right-wrapper').offset().top; // 获取元素距离顶部的偏移量 | ||
| 394 | + const availableHeight = windowHeight - topOffset; | ||
| 395 | + // 设置 .product-right-wrapper 的最大高度,确保不会溢出窗口 | ||
| 396 | + productRightWrapper.style.height = availableHeight + 'px'; | ||
| 397 | + }) | ||
| 398 | + } | ||
| 357 | }, | 399 | }, |
| 358 | onClick (item, index) { | 400 | onClick (item, index) { |
| 359 | this.product_info = item.info; | 401 | this.product_info = item.info; |
| ... | @@ -468,6 +510,7 @@ export default { | ... | @@ -468,6 +510,7 @@ export default { |
| 468 | flex-basis: 66.67%; | 510 | flex-basis: 66.67%; |
| 469 | background-color: @background-color; | 511 | background-color: @background-color; |
| 470 | padding: 1.75rem 1.5rem; | 512 | padding: 1.75rem 1.5rem; |
| 513 | + overflow: scroll; | ||
| 471 | .product-right-title { | 514 | .product-right-title { |
| 472 | display: flex; | 515 | display: flex; |
| 473 | justify-content: space-between; | 516 | justify-content: space-between; | ... | ... |
-
Please register or login to post a comment