From 89a1391b4026de1319e5c7a50f4efc8edce038df Mon Sep 17 00:00:00 2001 From: 18278715334 <18278715334@163.com> Date: Tue, 9 Dec 2025 15:12:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=E6=8A=BD=E5=B1=89?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/MainLayout.vue | 21 ++++++++- src/pages/products/index.vue | 91 ++++++++++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 6 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 927803c..1c337d3 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -16,10 +16,13 @@ /> - + + - + + +
{ .el-main { background: transparent; padding: 0; + transition: margin-left 0.3s ease; +} + +/* 移动端内容区域全宽显示 */ +.mobile-main { + width: 100% !important; + margin-left: 0 !important; } /* 性能优化:为低端设备提供简化样式 */ @@ -199,6 +211,11 @@ const handleUserCommand = async (command) => { .content-wrapper { padding: 0 12px 12px 12px; } + + /* 确保移动端容器全宽 */ + .el-container { + width: 100%; + } } /* 性能优化:减少动画效果 */ diff --git a/src/pages/products/index.vue b/src/pages/products/index.vue index 60113e0..46c204d 100644 --- a/src/pages/products/index.vue +++ b/src/pages/products/index.vue @@ -63,9 +63,17 @@ @@ -76,9 +84,11 @@ import FilterItem from '@/components/common/FilterItem.vue' import FilterSection from '@/components/common/FilterSection.vue' import ListPageLayout from '@/components/common/ListPageLayout.vue' import ProductCard from '@/components/product/ProductCard.vue' +import { useAppStore } from '@/stores/app' import { ElMessage, ElMessageBox } from 'element-plus' const router = useRouter() +const appStore = useAppStore() // 响应式数据 const loading = ref(false) @@ -97,6 +107,16 @@ const filters = reactive({ keyword: '' }) +// 响应式分页布局:移动端简化,桌面端完整 +const paginationLayout = computed(() => { + if (appStore.isMobile) { + // 移动端:只显示上一页、页码、下一页和总数 + return 'prev, pager, next, total' + } + // 桌面端:显示完整功能 + return 'total, sizes, prev, pager, next, jumper' +}) + // 搜索防抖 let searchTimer = null @@ -277,5 +297,68 @@ const handleCancelSubscribe = async (product) => {