新增大图预览
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Failing after 1m0s

This commit is contained in:
2025-08-25 13:43:38 +08:00
parent 9f37ef8252
commit 264053bd7e
2 changed files with 30 additions and 19 deletions

View File

@@ -29,10 +29,17 @@
<view class="detail-value remark"><text>备注</text>{{ detail.remark }}</view>
<view class="detail-value"><text class="detail-key">工单图片</text></view>
<view class="image-list" v-if="orderImgUrls.length > 0">
<u-image v-for="(imgUrl, index) in orderImgUrls" :key="index" :src="imgUrl"
width="200rpx" height="200rpx" border-radius="10rpx"
<u-image
v-for="(imgUrl, index) in orderImgUrls"
:key="index"
:src="imgUrl"
width="200rpx"
height="200rpx"
border-radius="10rpx"
@click="previewImage(orderImgUrls, index)"
style="margin-right: 20rpx; margin-bottom: 20rpx;"></u-image>
style="margin-right: 20rpx; margin-bottom: 20rpx;"
mode="aspectFill"
></u-image>
</view>
</view>
@@ -123,10 +130,14 @@
},
previewImage(urls, index) {
// 使用uView的图片预览组件
this.$u.previewImage({
urls: urls.filter(url => url.trim() !== ''),
current: index
});
// 过滤掉空值
const validUrls = urls.filter(url => url && url.trim() !== '')
uni.previewImage({
urls: validUrls,
current: validUrls[index], // current 必须是 url而不是索引
indicator: 'number', // 显示数字指示器
backgroundColor: '#000'
})
},
async onConfirm(selected) {
let params = this.detail