更新记录
1.0.0(2026-01-07)
下载此版本
master
平台兼容性
uni-app(4.13)
| Vue2 |
Vue3 |
Chrome |
Safari |
app-vue |
app-nvue |
Android |
iOS |
鸿蒙 |
| √ |
√ |
√ |
√ |
√ |
- |
√ |
√ |
√ |
| 微信小程序 |
支付宝小程序 |
抖音小程序 |
百度小程序 |
快手小程序 |
京东小程序 |
鸿蒙元服务 |
QQ小程序 |
飞书小程序 |
快应用-华为 |
快应用-联盟 |
| √ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
其他
安装
在市场导入xf-uploaderuni_modules版本的即可,无需import
组件关联说明
代码演示
基本用法
<template>
<view>
<u-form :model="formData" :rules="rules" ref="uFormRef">
<xf-uploader title="相册上传" :sourceType="['album']" v-model:fileList="formData.imagelist"></xf-uploader>
<xf-uploader title="拍照上传" :sourceType="['camera']" v-model:fileList="formData.imagelist2"></xf-uploader>
<xf-uploader title="相册/拍照上传" :required="false" :sourceType="['album', 'camera']"
v-model:fileList="formData.imagelist3"></xf-uploader>
<xf-uploader title="视频上传" :sourceType="['video']" :showItemLabel="true"
v-model:fileList="formData.imagelist4"></xf-uploader>
<xf-uploader title="文件上传" :sourceType="['file']" :showItemLabel="true"
v-model:fileList="formData.imagelist5"></xf-uploader>
</u-form>
</view>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { FileStatus, XFFileModel } from '../../../uni_modules/xf-ts/type/type-xf';
const formData = ref({
imagelist: [],
imagelist2: [{ url: 'https://cf-hz-test-01.xiaofengwang.com/order/orderNum/pic/%E8%AE%A2%E5%8D%95%E4%BF%A1%E6%81%AF_1760685017727_a_photo_3.jpeg', name: 'xxx.png' }],
imagelist3: [],
imagelist4: [{ url: 'https://cf-hz-test-01.xiaofengwang.com/order/orderNum/pic/订单信息_1760336257603_IMG_0127_compressMedium.mp4', name: 'xxx.mp4', ext: 'mp4' }],
imagelist5: [{ url: 'https://cf-hz-test-01.xiaofengwang.com/order/orderNum/pic/%E8%AE%A2%E5%8D%95%E4%BF%A1%E6%81%AF_1760341728765_25337000000476126375_%E6%9D%AD%E5%B7%9E%E7%82%B3%E7%82%B3%E5%85%B6%E7%AB%A0%E7%BD%91%E7%BB%9C%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8.pdf', name: '杭州炳炳其章网络科技有限公司.pdf', ext: 'pdf' }],
})
</script>
API
Props
| 属性名 |
说明 |
类型 |
默认值 |
| v-model:fileList |
上传的文件列表 |
array<XFFileModel> |
- |
| title |
表单标题 |
string |
标题 |
| tip |
提示内容 |
string |
- |
| bottomTip |
表单副标题 |
string |
- |
| required |
是否必填 |
boolean |
true |
| itemCount |
grid布局一行显示几个item |
number |
4 |
| gridColumnGap |
列间距 |
number |
10 |
| gridRowGap |
行间距 |
number |
10 |
| showItemLabel |
是否显示文件名称 |
boolean |
false |
| sourceType |
上传文件类型'album', 'camera', 'file' , 'video' |
array |
['album', 'camera'] |
| maxLength |
上传最大数量 |
number |
9 |
| quality |
图片质量 |
number |
0.8 |
| ossObjectKey |
阿里云oss对象key |
string |
- |