Skip to content

Commit

Permalink
feat(uploader): suppport chooseMedia in web (#2902)
Browse files Browse the repository at this point in the history
* feat: suppport chooseMedia in web

* feat: suppport chooseMedia in web
  • Loading branch information
Alex-huxiyang authored Dec 30, 2024
1 parent c53503a commit 9cfb6e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/packages/uploader/doc.taro.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ app.post('/upload', upload.single('file'), (req, res) => {
| maxCount | 文件上传数量限制 | `number` \| `string` | `1` |
| fit | 图片填充模式 | `contain` \| `cover` \| `fill` \| `none` \| `scale-down` | `cover` |
| sourceType | [选择文件的来源]("https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html") | `Array` | `['album','camera']` |
| camera`仅支持WEAPP` | 仅在 `source-type``camera` 时生效,使用前置或后置摄像头 | `String` | `back` |
| camera | 仅在 `source-type``camera` 时生效,使用前置或后置摄像头 | `String` | `back` |
| sizeType | [是否压缩所选文件]("https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html") | `Array` | `['original','compressed']` |
| mediaType`仅支持WEAPP` | [选择文件类型]("https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html") | `Array` | `['image', 'video', 'mix']` |
| maxDuration`仅支持WEAPP` | 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 | `number` | `10` |
| mediaType | [选择文件类型]("https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html") | `Array` | `['image', 'video', 'mix']` |
| maxDuration | 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 | `number` | `10` |
| headers | 设置上传的请求头部 | `object` | `{}` |
| data | 附加上传的信息 formData | `object` | `{}` |
| uploadIcon | 上传区域<a href="#/zh-CN/icon">图标名称</a> | `ReactNode` | `-` |
Expand Down
2 changes: 1 addition & 1 deletion src/packages/uploader/uploader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const InternalUploader: ForwardRefRenderFunction<
document.body.appendChild(obj)
}
}
if ((getEnv() === 'WEAPP' || getEnv() === 'JD') && chooseMedia) {
if (['WEAPP', 'JD', 'WEB'].includes(getEnv()) && chooseMedia) {
// 其余端全部使用 chooseImage API
chooseMedia({
count: multiple ? (maxCount as number) * 1 - fileList.length : 1,
Expand Down

0 comments on commit 9cfb6e9

Please sign in to comment.