uniapp插件Android文件选择器支持多选和单选插件
支持多选和单选
温馨提示 如何调用插件
var plugin = uni.requireNativePlugin("yuange-chooseFile");
选择文件
chooseFile() { const _this = this; plugin.chooseFile({ multipleChoose: 'true' //是否多选 false单选 true多选 }, (ret) => { _this.title = JSON.stringify(ret); console.log(ret) }) }
回调结果数据格式
单选
{ "filePath": "/storage/emulated/0/Android/data/uni.UNI46583B4/cache/Screenshot_20240908_150554.jpg", "fileSize": 104803, "fileType": "jpg", "fileName": "Screenshot_20240908_150554.jpg", "code": 200, "msg": "操作成功" }
多选
{ "data": [ { "fileType": "jpg", "filePath": "/storage/emulated/0/Android/data/uni.UNI46583B4/cache/Screenshot_20240908_150554.jpg", "fileSize": 104803, "fileName": "Screenshot_20240908_150554.jpg" }, {"fileType": "jpg", "filePath": "/storage/emulated/0/Android/data/uni.UNI46583B4/cache/Screenshot_20240908_150551.jpg", "fileSize": 104803, "fileName": "Screenshot_20240908_150551.jpg" }, {"fileType": "jpg", "filePath": "/storage/emulated/0/Android/data/uni.UNI46583B4/cache/Screenshot_20240908_150550.jpg", "fileSize": 104803, "fileName": "Screenshot_20240908_150550.jpg" } ], "code": 200, "msg": "操作成功" }
评论