uni-app上传多图

uni-app上传多图_第1张图片 


			
				
				
			
			
				
				上传照片
			
		
	.flex{display: flex;justify-content: center;align-items: center;}
	.evaluate_five{justify-content: flex-start;flex-wrap: wrap;}
	.evaluate_five>view{width: 158rpx;height: 158rpx;border:1px solid rgba(204,204,204,1);margin-right: 20rpx;margin-bottom: 20rpx;padding: 10rpx;}
	.evaluate_five>view:nth-child(4n){margin-right: 0;}
	.evaluate_five image{max-width: 100%;max-height: 100%;}
	.evaluate_five_cents{position: relative;}

 

choose_image(){
				let that=this;
				uni.chooseImage({
				    count: 6, //最大上传6张
				    sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
				    sourceType: ['album'], //从相册选择
				    success: function (res) {
						console.log("图片路径",res);
						if(res.tempFilePaths.length>6){
							uni.showToast({
								icon:'none',
								title: '最多上传6张图片',
								duration: 2000
							});
						}else{
							uni.showLoading({
							    title: '上传中'
							});
							for(let k=0;k {
										console.log("上传成功",uploadFileRes);
										let url_href=that.url_href+JSON.parse(uploadFileRes.data).url;
										that.image_array.push(url_href);
										if(that.image_array.length==res.tempFilePaths.length){
											 uni.hideLoading();
										}
									}
								});
							}	
						}
				    }
				});
			},

 

你可能感兴趣的:(uni-app)