Skip to content

Commit 374a3d4

Browse files
authored
fix(Upload): fixed the max attribute being 0, the number of uploads is still limited (#3679)
1 parent f029db8 commit 374a3d4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/upload/upload.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default class Upload extends SuperComponent {
6767

6868
handleLimit(customFiles: UploadFile[], max: number) {
6969
if (max === 0) {
70-
max = 20;
70+
max = Number.MAX_SAFE_INTEGER;
7171
}
7272
this.setData({
7373
customFiles: customFiles.length > max ? customFiles.slice(0, max) : customFiles,
@@ -268,10 +268,10 @@ export default class Upload extends SuperComponent {
268268
},
269269

270270
chooseMedia(mediaType) {
271-
const { config, sizeLimit, customLimit } = this.data;
272-
271+
const { customLimit } = this.data;
272+
const { config, sizeLimit } = this.properties;
273273
wx.chooseMedia({
274-
count: customLimit,
274+
count: Math.min(20, customLimit),
275275
mediaType,
276276
...config,
277277
success: (res) => {
@@ -317,9 +317,10 @@ export default class Upload extends SuperComponent {
317317
},
318318

319319
chooseMessageFile(mediaType) {
320-
const { max, config, sizeLimit } = this.properties;
320+
const { customLimit } = this.data;
321+
const { config, sizeLimit } = this.properties;
321322
wx.chooseMessageFile({
322-
count: max,
323+
count: Math.min(100, customLimit),
323324
type: Array.isArray(mediaType) ? 'all' : mediaType,
324325
...config,
325326
success: (res) => {

0 commit comments

Comments
 (0)