first commit

This commit is contained in:
2026-06-02 10:42:33 +08:00
commit dd4975fd2c
1084 changed files with 442416 additions and 0 deletions

View File

@@ -0,0 +1,126 @@
# lime-choose-file 文件选择组件
一个基于UTS实现的文件选择插件参考小程序chooseFile API实现用法保持一致。支持安卓、iOS、鸿蒙和H5平台。提供了选择图片、视频和其他文件类型的功能。组件提供了简单易用的API使开发者能够方便地在应用中集成文件选择功能。
## 文档链接
📚 组件详细文档请访问以下站点:
- [文件选择组件文档 - 站点1](https://limex.qcoon.cn/native/choose-file.html)
- [文件选择组件文档 - 站点2](https://limeui.netlify.app/native/choose-file.html)
- [文件选择组件文档 - 站点3](https://limeui.familyzone.top/native/choose-file.html)
## 安装方法
1. 在uni-app插件市场中搜索并导入`lime-choose-file`
2. 导入后在页面引入相关方法
3. 需要自定义基座才能使用
4. 试用符合需求后才购买,插件无法退款
## 代码演示
### UNIAPPX 使用方式
```ts
import { chooseFile, type ChooseFileOption } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、iOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('选择结果:', res.tempFiles)
},
fail(err){
console.log('选择失败:', err)
}
} as ChooseFileOption)
}
```
### UNIAPP 使用方式
```ts
import { chooseFile } from '@/uni_modules/lime-choose-file'
const images = ref<string[]>([])
const onClick = () => {
chooseFile({
filename: 'xxxx', // 可选 用于给文件重命名安卓、iOS
type: 'image',
success(res){
images.value = res.tempFiles.map((item):string => item.path)
console.log('选择结果:', res.tempFiles)
},
fail(err){
console.log('选择失败:', err)
}
})
}
```
## API文档
### chooseFile 方法
| 参数 | 说明 | 类型 | 必填 |
| --- | --- | --- | --- |
| options | 文件选择选项 | _ChooseFileOption_ | 是 |
### ChooseFileOption 选项
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| filename | _string_ | 否 | 指定文件名用于给文件重命名安卓、iOS |
| count | _number_ | 否 | 最多可以选择的文件数量默认为100 |
| type | _string_ | 否 | 所选文件类型,默认为'all' |
| extension | _string[]_ | 否 | 根据文件拓展名过滤每一项都不能是空字符串。默认不过滤。仅H5支持 |
| success | _(result: ChooseFileSuccessCallbackResult) => void_ | 否 | 接口调用成功的回调函数 |
| fail | _(res: GeneralCallbackResult) => void_ | 否 | 接口调用失败的回调函数 |
| complete | _(res: GeneralCallbackResult) => void_ | 否 | 接口调用结束的回调函数 |
### ChooseFileSuccessCallbackResult 返回参数
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| tempFiles | _ChooseFile[]_ | 返回选择的文件的本地临时文件对象数组 |
| errMsg | _string_ | 错误信息 |
### ChooseFile 对象结构
| 参数 | 类型 | 说明 |
| --- | --- | --- |
| name | _string_ | 选择的文件名称 |
| path | _string_ | 本地临时文件路径 (本地路径) |
| size | _number_ | 本地临时文件大小,单位 B |
| time | _number_ | 选择的文件的会话发送时间Unix时间戳 |
| type | _'video' \| 'image' \| 'file' \| 'all'_ | 选择的文件类型 |
### 文件类型说明
| 类型值 | 说明 |
| --- | --- |
| video | 视频文件 |
| image | 图片文件 |
| file | 除图片和视频外的其他文件 |
| all | 所有类型文件 |
## 功能特点
- 支持多种文件类型的选择,包括图片、视频和其他文件
- 支持文件重命名功能
- 兼容安卓、iOS、鸿蒙和H5平台
- 提供简单易用的API接口
- 支持指定最大选择数量
- 支持文件扩展名过滤H5平台
## 常见问题
- iOS路径是中文时无法上传到服务器这时候需要设置`filename`给文件重命名
- APP端需要自定义基座才能使用
- 文件选择后会返回临时文件路径,需要及时使用或保存
- H5端可以通过extension参数过滤文件类型
## 支持与赞赏
如果你觉得本插件解决了你的问题,可以考虑支持作者:
| 支付宝赞助 | 微信赞助 |
|------------|------------|
| ![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/alipay.png) | ![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/wpay.png) |