diff --git a/interfaces/kits/picker/picker.js b/interfaces/kits/picker/picker.js index 78428f991471ac4a9b7b98da4a94cbc602272850..ac9eb5be89540aada49f1f8e5c0294add4a8e5b4 100644 --- a/interfaces/kits/picker/picker.js +++ b/interfaces/kits/picker/picker.js @@ -158,6 +158,20 @@ function parseDocumentPickerSelectOption(args) { } }; + if (args.length > ARGS_ZERO && typeof args[ARGS_ZERO] === 'object') { + let option = args[ARGS_ZERO]; + + if (('maxSelectNumber' in option) && option.maxSelectNumber > 0) { + config.parameters.key_pick_num = option.maxSelectNumber;//选择文件数量 + } + if ('defaultFilePathUri' in option) { + config.parameters.key_pick_dir_path = option.defaultFilePathUri;//默认路径URI + } + if (('fileSuffixFilter' in option) && option.fileSuffixFilter.length > 0) { + config.parameters.fileSuffixFilter = option.fileSuffixFilter;//文件后缀选择 + } + } + return config; } @@ -222,10 +236,16 @@ function parseDocumentPickerSaveOption(args) { if (args.length > ARGS_ZERO && typeof args[ARGS_ZERO] === 'object') { let option = args[ARGS_ZERO]; - if (option.newFileNames.length > 0) { + if (('newFileNames' in option) && option.newFileNames.length > 0) { config.parameters.key_pick_file_name = option.newFileNames; config.parameters.saveFile = option.newFileNames[0]; } + if ('defaultFilePathUri' in option) { + config.parameters.key_pick_dir_path = option.defaultFilePathUri;//默认路径URI + } + if (('fileSuffixChoices' in option) && option.fileSuffixChoices.length > 0) { + config.parameters.key_pick_file_types = option.fileSuffixChoices;//文件后缀选择 + } } return config; @@ -328,10 +348,16 @@ function PhotoSaveOptions() { this.newFileNames = []; } -function DocumentSelectOptions() {} +function DocumentSelectOptions() { + this.defaultFilePathUri = undefined; + this.fileSuffixFilters = undefined; + this.maxSelectNumber = undefined; +} function DocumentSaveOptions() { this.newFileNames = []; + this.defaultFilePathUri = undefined; + this.fileSuffixChoices = undefined; } function AudioSelectOptions() {}