<view class="yform-image" @click="upLoadImg('positive')">
<image v-if="idPositive" :src="idPositive" mode="aspectFit"></image>
<image v-else src='../../static/img/s-check-camera.png' mode=""></image>
</view>
that.idPositive console 后有值 但是 image不变还是默认图片 浏览器正常 真机 无反应 场景 uni H5
upLoadImg(type) {
let that = this
uni.chooseImage({
count:1,
success: imgSrc => {
that.idPositive = imgSrc.tempFilePaths[0]
uni.uploadFile({
url: this.$serverUrl + '/fastdfs/upload',
header:{
// Authorization: 'Bearer '+ uni.getStorageSync('access_token')
},
filePath: imgSrc.tempFilePaths[0],
name: 'file',
success: res => {
let data = JSON.parse(res.data), idx;
if(type == 'positive') {
// this.idPositive = this.$store.state.fastdfsUrl + data.diskFileName;
idx = 1;
} else {
this.idBack = this.$store.state.fastdfsUrl + data.diskFileName;
idx = 2;
}
this.remarks[idx].fileName = data.fileName;
this.remarks[idx].diskFileName = data.diskFileName;
this.remarks[idx].uploadTime = data.uploadTime;
this.remarks[idx].fileType = data.fileType;
}
})
}
})
},
0 个回复