From bd140af7147412d6ecd345ef8ae33e73baef08b8 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Thu, 15 May 2025 09:54:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96headerbar=E9=81=AE=E6=8C=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-web/src/components/HeaderBar.vue | 65 ++++--------------- 1 file changed, 13 insertions(+), 52 deletions(-) diff --git a/main/manager-web/src/components/HeaderBar.vue b/main/manager-web/src/components/HeaderBar.vue index 39075462..842441ce 100644 --- a/main/manager-web/src/components/HeaderBar.vue +++ b/main/manager-web/src/components/HeaderBar.vue @@ -58,7 +58,7 @@
-
+
@@ -103,7 +103,8 @@ export default { }, isChangePasswordDialogVisible: false, // 控制修改密码弹窗的显示 userDropdownVisible: false, - paramDropdownVisible: false + paramDropdownVisible: false, + isSmallScreen: false } }, computed: { @@ -113,7 +114,13 @@ export default { } }, mounted() { - this.fetchUserInfo() + this.fetchUserInfo(); + this.checkScreenSize(); + window.addEventListener('resize', this.checkScreenSize); + }, + //移除事件监听器 + beforeDestroy() { + window.removeEventListener('resize', this.checkScreenSize); }, methods: { goHome() { @@ -147,7 +154,9 @@ export default { } }) }, - + checkScreenSize() { + this.isSmallScreen = window.innerWidth <= 1386; + }, // 处理搜索 handleSearch() { const searchValue = this.search.trim(); @@ -354,45 +363,6 @@ export default { } } -@media (max-width: 1024px) { - .search-container { - margin-right: 10px; - max-width: 150px; - } - - .header-right { - gap: 5px; - } -} - -@media (max-width: 900px) { - .header-left { - margin-right: auto; - } - - .search-container { - max-width: 150px; - } -} - -@media (max-width: 768px) { - .search-container { - max-width: 145px; - } - - .custom-search-input>>>.el-input__inner { - padding-left: 10px; - font-size: 11px; - } -} - -@media (max-width: 600px) { - .search-container { - max-width: 120px; - min-width: 100px; - } -} - .equipment-management.more-dropdown { position: relative; } @@ -411,13 +381,4 @@ export default { color: #606266; white-space: nowrap; } - -@media (max-width: 768px) { - .equipment-management.more-dropdown .el-dropdown-menu { - position: fixed; - right: 10px; - top: 60px; - z-index: 2000; - } -} \ No newline at end of file