上传组件限制
This commit is contained in:
@@ -88,8 +88,10 @@ export default {
|
|||||||
this.$emit('list', this.fileList)
|
this.$emit('list', this.fileList)
|
||||||
},
|
},
|
||||||
upload(wait) {
|
upload(wait) {
|
||||||
|
let count = this.limit - (this.fileList?.length||0)
|
||||||
|
if(count>0){
|
||||||
let params = {
|
let params = {
|
||||||
count: this.limit,
|
count,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
sourceType: [this.sourceType].flat(),
|
sourceType: [this.sourceType].flat(),
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
@@ -114,6 +116,10 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
uni.chooseFile(params)
|
uni.chooseFile(params)
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
this.$u.toast(`不能超过${this.limit}个`)
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
uploadFile(img) {
|
uploadFile(img) {
|
||||||
if (this.size > 0 && img.size > this.size) {
|
if (this.size > 0 && img.size > this.size) {
|
||||||
|
|||||||
Reference in New Issue
Block a user