for="(item,index) in (fileList || showList)" :key="index" class="img_boxs" @click='lookImg(item,index)'>
"item" alt="" class="showImgs">
"https://cdn.widsomhome.com/wechat/wisdomHome/dele.png" alt="" class="deleImg" @click.stop="deleClick(item,index)">
div>
afterRead(){
var that=this;
let imagesList=[];
let maxSize=1024*1024*5;
let maxLength=3;
let flag=true;
// this.fileList.push(event.target.file.path) ;
wx.chooseImage({
count: 3, //最多可以选择的图片总数
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
wx.showToast({
title: '正在上传...',
icon: 'loading',
mask: true,
duration: 500
})
console.log(res,'本地图片')
for (let i = 0; i < res.tempFiles.length; i++) {
if (res.tempFiles[i].size > maxSize) {
flag = false;
wx.showModal({
content: '图片太大,不允许上传',
showCancel: false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定')
}
}
});
}
}
if (res.tempFiles.length > maxLength) {
console.log('222');
wx.showModal({
content: '最多能上传' + maxLength + '张图片',
showCancel: false,
success: function (res) {
if (res.confirm) {
console.log('确定');
}
}
})
}
if (flag == true && res.tempFiles.length <= maxLength) {
// 压缩图片
// res.tempFilePaths.map((val,index)=>{
// console.log(val,'=====');
// wx.compressImage({
// src: val, // 图片路径
// quality: 50 ,// 压缩质量
// success:function(data){
// console.log(data,'图片压缩');
// that.fileList.push(data.tempFilePath);
// that.uploadFileImg(data.tempFilePath);
// }
// })
// })
res.tempFilePaths.map((val,index)=>{
imagesList.push(val)
that.fileList.push(val);
})
that.uploadFileImg(imagesList);
// console.log(that.fileList,'监听tu')
that.$forceUpdate();
}
}
})
}
值console出来,fileList 不渲染在安卓中 ?