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) => {