uniapp查看文章实现图片预览效果

1.将图片数据循环并添加magnifyImag事件显示弹框

u-swiper绑定的数组为图片url数组

//第一种
<view class="profileDetail"> 
    <view class="picList">
	<scroll-view class="scroll-view_H" :scroll-x="true" scroll-left="0">
	    <u-image v-for="(item, index) in rmImagList" :key="index" class="scroll-view-item_H" width="260rpx" height="156rpx" :src="item" @click="magnifyImag(item)"></u-image>
	</scroll-view>
	<u-popup v-model="showBigImag" mode="center" :zoom="false">
		<view class="" style="width: 690rpx; height: 486rpx;">
            <u-swiper :list="rmImagList" height="486"></u-swiper>
        </view>
	</u-popup>
</view>

</view>

//第二种写法:

<view class="img_box" v-for="(it,index) in imgList" :key="index">
	<image :src="it" mode="aspectFill" @click="magnifyImag(it)">
				</image>
</view>

<u-popup v-model="showBigImag" mode="center" :zoom="false">
	<view class="" style="width: 690rpx; height: 486rpx;">
		<u-swiper :list="imgList" height="486"></u-swiper>
	</view>
</u-popup>
.profileDetail {
		line-height: 48rpx;
		margin: 20rpx 0;

		.picList {
			width: 100%;
			display: flex;

			.u-image {
				flex: 1;
				margin: 0 10rpx 10rpx;
			}
		}

		img {
			width: 100%;
			height: auto;
			margin-top: 20rpx;
		}
	}

.scroll-view_H {
		display: flex;
		flex-direction: row;
		white-space: nowrap;
		width: 100%;
	}

	.scroll-Y {
		height: 300rpx;
	}


	.scroll-view-item {
		text-align: center;
		font-size: 36rpx;
	}

	.scroll-view-item_H {
		display: inline-block;
		text-align: center;
		font-size: 36rpx;
	}

 2.点击显示弹窗,并复制当前点击的图片放大

magnifyImag(imgSrc) {
				this.showBigImag = !this.showBigImag;
				//this.bigImagSrc = imgSrc;
			}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值