diff --git a/interfaces/kits/picker/picker.js b/interfaces/kits/picker/picker.js index abc2c5144a3791743807c7c468a0ae9a0462fca9..7c8bd5ce58b6a8cdaff07c0040b474adcca67de6 100644 --- a/interfaces/kits/picker/picker.js +++ b/interfaces/kits/picker/picker.js @@ -20,6 +20,9 @@ const PhotoViewMIMETypes = { INVALID_TYPE: '' } +const DocumentViewSelectTypes = { + FILE_TYPE : 0, +} const ErrCode = { INVALID_ARGS: 13900020, RESULT_ERROR: 13900042, @@ -141,6 +144,16 @@ async function documentPickerSelect(...args) { startMode: 'choose', } } + if (args.length >ARGS_ZERO && args[ARGS_ZERO]==='object'){ + let option =args[ARGS_ZERO]; + if(option.length>0){ + config.parameters.selectMode = DocumentViewSelectType.FILE_TYPE; + config.parameters.key_pick_num =option.maxSelectNumber;//选择文件数量 + config.parameters.key_pick_dir_path= option.defaultFilePathUri;//默认路径URI + config.parameters.fileSuffixFilters =option.fileSuffixFilter;//文件后缀选择 + + } + } console.log('[picker] config: ' + JSON.stringify(config)); try { @@ -190,6 +203,8 @@ async function documentPickerSave(...args) { if (option.newFileNames.length > 0) { config.parameters.key_pick_file_name = option.newFileNames; config.parameters.saveFile = option.newFileNames[0]; + config.parameters.defaultFilePathUri = option.key_pick_dir_path;//默认文件路径 + config.parameters.fileSuffixChoices = option.key_pick_file_types;//保存文件的格式 } } console.log('[picker] config: ' + JSON.stringify(config)); @@ -282,10 +297,17 @@ function PhotoSaveOptions() { this.newFileNames = []; } -function DocumentSelectOptions() {} +function DocumentSelectOptions() { + this.selectMode = DocumentViewSelectTypes.FILE_TYPE; + this.maxSelectNumber = -1; + this.defaultFilePathUri = uris; + this.fileSuffixFillters = array[string]; +} function DocumentSaveOptions() { this.newFileNames = []; + this.defaultFilePathUri = uris; + this.fileSuffixChoices = key_pick_dir_path; } function AudioSelectOptions() {}