hookehuyr

fix 头部菜单栏可能显示错误问题

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-29 14:56:57 4 + * @LastEditTime: 2024-10-31 13:50:28
5 * @FilePath: /hager/src/components/common/hagerHeader.vue 5 * @FilePath: /hager/src/components/common/hagerHeader.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -284,13 +284,13 @@ export default { ...@@ -284,13 +284,13 @@ export default {
284 return false; // 元素被挡住或部分被遮挡 284 return false; // 元素被挡住或部分被遮挡
285 } 285 }
286 } 286 }
287 - var $productRightWrapper = $('.product-right-wrapper'); 287 + this.$nextTick(() => {
288 + var $productRightWrapper = $('.product-right-wrapper');
288 289
289 - if (isElementVisible($productRightWrapper)) { 290 + if (isElementVisible($productRightWrapper)) {
290 - console.log(".product-right-wrapper 完全可见"); 291 + console.log(".product-right-wrapper 完全可见");
291 - } else { 292 + } else {
292 - console.log(".product-right-wrapper 被部分或完全遮挡"); 293 + console.log(".product-right-wrapper 被部分或完全遮挡");
293 - this.$nextTick(() => {
294 const productRightWrapper = document.querySelector('.product-right-wrapper'); 294 const productRightWrapper = document.querySelector('.product-right-wrapper');
295 // 获取窗口的高度 295 // 获取窗口的高度
296 const windowHeight = $(window).height(); 296 const windowHeight = $(window).height();
...@@ -299,8 +299,8 @@ export default { ...@@ -299,8 +299,8 @@ export default {
299 const availableHeight = windowHeight - topOffset; 299 const availableHeight = windowHeight - topOffset;
300 // 设置 .product-right-wrapper 的最大高度,确保不会溢出窗口 300 // 设置 .product-right-wrapper 的最大高度,确保不会溢出窗口
301 productRightWrapper.style.height = availableHeight + 'px'; 301 productRightWrapper.style.height = availableHeight + 'px';
302 - }) 302 + }
303 - } 303 + })
304 }, 304 },
305 onClick (item, index) { 305 onClick (item, index) {
306 this.product_info = item.children; 306 this.product_info = item.children;
......