From c291177ec11ce9b6455b569d7e1672065ca4c8c7 Mon Sep 17 00:00:00 2001 From: Yukino_fox Date: Sun, 22 Mar 2026 20:10:04 +0800 Subject: [PATCH] =?UTF-8?q?style(css):=20=E4=BC=98=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=AB=AF=E5=B0=8F=E5=B1=8F=E8=AE=BE=E5=A4=87=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 调整移动端小屏设备下的组件尺寸和布局,包括侧边栏菜单、按钮、输入框、表格和模态框等,提升触摸操作体验和可读性。移除冗余的媒体查询规则,统一使用平台特定的选择器进行适配。 --- src/assets/main.css | 102 +++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 64 deletions(-) diff --git a/src/assets/main.css b/src/assets/main.css index d9ecd78..238b7b3 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -102,30 +102,43 @@ select { ); } -@media (pointer: coarse) { - .ss-sidebar .ant-menu-item { +/* 移动平台(iOS/Android)小屏设备适配 */ +@media (max-width: 768px) { + /* 侧边栏菜单项增大触摸区域 */ + html.platform-ios .ss-sidebar .ant-menu-item, + html.platform-android .ss-sidebar .ant-menu-item { min-height: 48px; font-size: 16px; } - .ant-btn { - min-height: 44px; + /* 按钮和输入框保持合适大小 */ + html.platform-ios .ant-btn, + html.platform-android .ant-btn { + min-height: 40px; } - .ant-input, - .ant-select-selector, - .ant-input-number { - min-height: 44px; + html.platform-ios .ant-input, + html.platform-ios .ant-select-selector, + html.platform-ios .ant-input-number, + html.platform-android .ant-input, + html.platform-android .ant-select-selector, + html.platform-android .ant-input-number { + min-height: 40px; font-size: 16px; } - .ant-table th, - .ant-table td { - padding-top: 14px; - padding-bottom: 14px; + /* 表格单元格增加内边距 */ + html.platform-ios .ant-table th, + html.platform-ios .ant-table td, + html.platform-android .ant-table th, + html.platform-android .ant-table td { + padding-top: 12px; + padding-bottom: 12px; } - .ant-modal { + /* 模态框全屏 */ + html.platform-ios .ant-modal, + html.platform-android .ant-modal { max-width: 100vw !important; width: 100vw !important; margin: 0 !important; @@ -136,80 +149,41 @@ select { right: 0 !important; } - .ant-modal-content { + html.platform-ios .ant-modal-content, + html.platform-android .ant-modal-content { height: 100vh !important; border-radius: 0 !important; display: flex !important; flex-direction: column !important; } - .ant-modal-body { + html.platform-ios .ant-modal-body, + html.platform-android .ant-modal-body { flex: 1 !important; overflow-y: auto !important; overflow-x: hidden !important; -webkit-overflow-scrolling: touch !important; } - .ant-modal-wrap { + html.platform-ios .ant-modal-wrap, + html.platform-android .ant-modal-wrap { overflow: hidden !important; } - .ant-select-dropdown { + /* 下拉菜单高度限制 */ + html.platform-ios .ant-select-dropdown, + html.platform-android .ant-select-dropdown { max-height: 50vh !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch !important; } - .ant-table-wrapper { + /* 表格横向滚动 */ + html.platform-ios .ant-table-wrapper, + html.platform-android .ant-table-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; } - - .ant-table { - min-width: 600px !important; - } -} - -@media (max-width: 480px) { - .ant-modal { - max-width: 100vw !important; - width: 100vw !important; - margin: 0 !important; - padding: 0 !important; - } - - .ant-modal-content { - height: 100vh !important; - border-radius: 0 !important; - display: flex !important; - flex-direction: column !important; - } - - .ant-modal-body { - flex: 1 !important; - overflow-y: auto !important; - overflow-x: hidden !important; - -webkit-overflow-scrolling: touch !important; - } - - .ant-modal-wrap { - overflow: hidden !important; - } - - .ant-table-container { - overflow-x: auto !important; - -webkit-overflow-scrolling: touch !important; - } - - .ant-table { - min-width: 600px !important; - } - - .ant-select-dropdown { - max-height: 50vh !important; - overflow-y: auto !important; - -webkit-overflow-scrolling: touch !important; - } } .ss-table-center .ant-table th,