hookehuyr

feat(article): 文章图片列表改为网格布局

- 移除横向滚动视图
- 使用 flex-wrap 实现网格布局
- 每行显示3张图片,自动换行
- 所有图片可一次性查看完成

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
...@@ -48,18 +48,16 @@ ...@@ -48,18 +48,16 @@
48 <!-- 文章图片列表(点击可预览) --> 48 <!-- 文章图片列表(点击可预览) -->
49 <view v-if="imageUrls.length > 0" class="article-images-section px-[32rpx] pb-[32rpx]"> 49 <view v-if="imageUrls.length > 0" class="article-images-section px-[32rpx] pb-[32rpx]">
50 <view class="section-title">文章图片</view> 50 <view class="section-title">文章图片</view>
51 - <scroll-view scroll-x class="image-scroll-view"> 51 + <view class="image-grid">
52 - <view class="image-list"> 52 + <view
53 - <view 53 + v-for="(url, index) in imageUrls"
54 - v-for="(url, index) in imageUrls" 54 + :key="index"
55 - :key="index" 55 + class="image-item"
56 - class="image-item" 56 + @tap="previewImage(url)"
57 - @tap="previewImage(url)" 57 + >
58 - > 58 + <image :src="url" mode="aspectFill" class="thumbnail-image" />
59 - <image :src="url" mode="aspectFill" class="thumbnail-image" />
60 - </view>
61 </view> 59 </view>
62 - </scroll-view> 60 + </view>
63 </view> 61 </view>
64 </view> 62 </view>
65 63
...@@ -503,7 +501,7 @@ useLoad((options) => { ...@@ -503,7 +501,7 @@ useLoad((options) => {
503 min-height: 400rpx; 501 min-height: 400rpx;
504 } 502 }
505 503
506 -/* 文章图片列表区域 */ 504 +/* 文章图片列表区域 - 网格布局 */
507 .article-images-section { 505 .article-images-section {
508 margin-top: 24rpx; 506 margin-top: 24rpx;
509 } 507 }
...@@ -515,19 +513,18 @@ useLoad((options) => { ...@@ -515,19 +513,18 @@ useLoad((options) => {
515 margin-bottom: 16rpx; 513 margin-bottom: 16rpx;
516 } 514 }
517 515
518 -.image-scroll-view { 516 +.image-grid {
519 - white-space: nowrap; 517 + display: flex;
520 -} 518 + flex-wrap: wrap;
521 -
522 -.image-list {
523 - display: inline-flex;
524 gap: 16rpx; 519 gap: 16rpx;
520 + /* 每行3个图片:计算公式:(750rpx - 64rpx padding - 32rpx gaps) / 3 ≈ 218rpx */
525 } 521 }
526 522
527 .image-item { 523 .image-item {
528 - flex-shrink: 0; 524 + /* 每行3个,宽度约占 1/3 */
529 - width: 160rpx; 525 + width: calc((100% - 32rpx) / 3);
530 - height: 160rpx; 526 + /* 保持正方形 */
527 + aspect-ratio: 1;
531 border-radius: 12rpx; 528 border-radius: 12rpx;
532 overflow: hidden; 529 overflow: hidden;
533 background-color: #F3F4F6; 530 background-color: #F3F4F6;
......