uni.chooseMedia({
count: 6 - this.uploadLists.length,
mediaType: this.mediaType,
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: this.sourceType,
maxDuration: 30,
success: (res) => {
console.log('tempFiles', res)
if (this.action == '') { //未配置上传路径
this.mType = res.type
console.log(this.mType);
this.$emit("chooseSuccess", res.tempFiles);
} else {
if (this.compress && (res.tempFiles[0].size / 1024 > 1025)) { //设置了需要压缩 并且 文件大于1M,进行压缩上传
this.imgCompress(res.tempFiles);
} else {
this.imgUpload(res.tempFiles);
}
}
}
});