更新记录
1.3.12(2026-08-13)
1.3.12(2026-08-13)
- iOS:UTS
number对应 SwiftNSNumber(失败回调/size),不再用Double
1.3.11(2026-08-13)
- iOS:修复
Int无toInt(生成 Swift 后字面量/code已是 Int);失败回调改为number/Double
1.3.10(2026-08-13)
- iOS 一次性加固(针对历史云打包错误):
- 禁止依赖
DCloudUniappRuntime/DCloudUTSFoundation(纯 UIKit) - 继续禁用
UTType(需 iOS 14+),使用 UTI 字符串 + iOS 12 选择器 API count强制(n).toInt(),避免 NSNumber- 顶层 VC 用 UIKit 自取;大文件优先
FileManager.copyItem config.json显式声明 Foundation/UIKit,deploymentTarget12.0
- 禁止依赖
1.3.9(2026-08-13)
- iOS:移除
DCloudUniappRuntime依赖,改用 UIKit 获取顶层 VC(兼容 uni-app 云打包)
1.3.8(2026-08-12)
- iOS:
count明确传Int;清理说明,避免云打包沿用旧 index.uts 缓存
1.3.7(2026-08-12)
- iOS 改为 Swift 原生混编
SelectFilesNative.swift,UTS 仅做薄封装,规避 Delegate/throws/NSNumber 编译问题
1.3.6(2026-08-12)
- 修复 iOS:Delegate 改为 NSObject 子类;文件拷贝改 NSData/NSSearchPath,规避 Swift throws / 协议无法 new
1.3.5(2026-08-12)
- 修复 iOS 云打包:FileManager / UIDocumentPicker 改为 Swift 标签 API,避免 ObjC 拼接方法名编译失败
1.3.4(2026-08-12)
- 修复 iOS 模拟器打包:去掉 UTType(需 iOS 14+),改用 UTI 字符串 + UIDocumentPickerMode.import
1.3.3(2026-08-12)
- 修复数字字面量
.toInt()被解析为小数点导致编译失败(改为(80201).toInt())
1.3.2(2026-08-12)
- 修复 Android 打包 Number/Int:Java API 参数统一
.toInt()
1.3.1(2026-08-12)
- 修复 Android 云打包编译失败:
ByteArray/Int/ activityResult 回调引用
1.3.0(2026-08-12)
- 按市场售卖模式拆分:本插件仅 Android / iOS
- 鸿蒙能力迁移至免费配套插件
uts-ebook-picker-harmony - 完善
package.json市场字段与平台声明
1.2.0(2026-08-12)
- 增加 Harmony 实现(后拆出)
1.0.0(2026-08-12)
- 初版 Android / iOS 文件选择
平台兼容性
uni-app(3.8.1)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | √ | √ | - |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 小红书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| - | - | - | - | - | - | - | - | - | - | - | - |
ebook-select-files
UTS App 全文件选择器(Android / iOS)。统一返回文件路径、名称、大小、后缀和 MIME。
需要鸿蒙?请同时安装免费配套插件 ebook-select-files-harmony
售卖与试用说明(插件市场)
| 插件 | 平台 | 建议售卖方式 |
|---|---|---|
ebook-select-files(本插件) |
Android / iOS | 普通授权版 + 源码授权版;支持市场免费试用 |
ebook-select-files-harmony |
仅 Harmony | 免费发布,拉新与三端闭环 |
发布时在 DCloud 插件市场 分别上传两个 uni_modules 包;付费版可在后台开启加密与试用。
与鸿蒙组合实现三端
两个插件的 API / 回调结构保持一致,业务侧用适配文件统一导入:
// utils/select-files.js
// #ifdef APP-HARMONY
export {
selectFiles,
getSelectFilesCapabilities,
} from '@/uni_modules/ebook-select-files-harmony'
// #endif
// #ifndef APP-HARMONY
export {
selectFiles,
getSelectFilesCapabilities,
} from '@/uni_modules/ebook-select-files'
// #endif
业务代码只写:
import { selectFiles, getSelectFilesCapabilities } from '@/utils/select-files'
安装
- 将本目录放入项目
uni_modules/ebook-select-files - (可选)安装
ebook-select-files-harmony以支持鸿蒙 - 制作自定义调试基座后运行
iOS 配置
manifest.json:
"app-plus": {
"ios": {
"plist": {
"UIFileSharingEnabled": true,
"LSSupportsOpeningDocumentsInPlace": true
}
}
}
API
selectFiles(options)
| 字段 | 说明 |
|---|---|
count |
最多选择数量,默认 1 |
extensions |
后缀数组,如 ['pdf','docx'];空或不传表示不限制 |
mimeTypes |
MIME 数组;更推荐直接传 extensions |
copyToCache |
是否复制到应用缓存,默认 true |
success / fail / complete |
回调 |
getSelectFilesCapabilities()
返回:supported、platform、supportsMultiple、supportsExtensions、supportsMimeTypes、supportsCopyToCache、notes。
返回结果
单个文件:name、path、uri、size、ext、mimeType
完整:ok、platform、count、copied、files、errCode、errMsg
最小示例
import { selectFiles } from '@/uni_modules/ebook-select-files'
selectFiles({
count: 2,
extensions: ['pdf', 'docx'],
copyToCache: true,
success(res) {
console.log('select-files-success', res)
},
fail(res) {
console.log('select-files-fail', res)
},
})
注意
copyToCache: true时返回应用目录内稳定路径,便于上传copyToCache: false时可能是临时路径或原始uri- 三端统一请同时安装
ebook-select-files-harmony - 用户取消:
errCode = 8020001,errMsg = 'cancel'
隐私、权限声明
- 本插件需要申请的系统权限列表:无(使用系统文件选择器)
- 本插件采集的数据、发送的服务器地址、以及数据用途说明:无
- 本插件是否包含广告:无

收藏人数:
购买源码授权版(
试用
赞赏(0)
下载 141
赞赏 0
下载 12504573
赞赏 1941
赞赏
京公网安备:11010802035340号