上传组件限制

This commit is contained in:
aixianling
2022-04-27 14:41:35 +08:00
parent fbfae4ec41
commit 4b5ada5f9d

View File

@@ -88,8 +88,10 @@ export default {
this.$emit('list', this.fileList)
},
upload(wait) {
let count = this.limit - (this.fileList?.length||0)
if(count>0){
let params = {
count: this.limit,
count,
sizeType: ['compressed'],
sourceType: [this.sourceType].flat(),
success: (res) => {
@@ -114,6 +116,10 @@ export default {
} else {
uni.chooseFile(params)
}
}else{
this.$u.toast(`不能超过${this.limit}`)
}
},
uploadFile(img) {
if (this.size > 0 && img.size > this.size) {