0.0.26 • Published 4 years ago

@retailwe/ui-uploader v0.0.26

Weekly downloads
2
License
-
Repository
-
Last release
4 years ago

uploader 上传

效果预览

如果/page/components-exp文件夹存在,且app.jsonexample分包配置存在时,在小程序开发者工具中输入以下命令进入预览页面。

wx.navigateTo({
  url: '/supermarket/pages/components-exp/uploader/index',
  complete() { console.log(arguments[0].errMsg) }
})

引入

全局引入,在miniprogram根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

// app.json 或 index.json
"usingComponents": {
  "uploader": "@retailwe/ui-uploader/index"
}

代码演示

基础用法

<uploader
  media-type="{{['image']}}"
  add-text="选择图片"
  limit="9"
  img-size-limit="{{100*1024}}"
  bindchoose="onChoose"
  bindchoosefailed="onChooseFailed"
  binddelete="onDelete"
></uploader>

API

uploader Props

参数说明类型默认值版本
limit最多可上传图片数number9-
files原有图片列表array[]-
videoDuration视频最大录制长度number10-
addIcon添加按钮iconstringcamera-
addText添加按钮文本string添加-
mediaType支持上传的文件类型,图片或视频array['image', 'video']-
sourceType文件获取方式,相册/相机,详细请参考小程序官方文档array['album', 'camera']-
sizeType文件大小,详细请参考小程序官方文档array['original', 'compressed']-
ImgSizeLimit图片文件大小限制number0-
videoSizeLimit视频文件大小限制number0-

files的结构 | path | 文件url/路径 | string | - | - | | size | 文件大小 | string | - | - |

uploader Event

事件名说明参数
choose选择文件后触发本次选择的文件列表,形如:[{files: path: '', size: 0}]
choosefailed文件选择失败/取消文件选择时触发err,错误原因
delete删除已选文件时触发,返回被删除文件的索引{index}

uploader 外部样式类

类名说明
wr-class控件每一项根节点样式类
0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7-beta.1

4 years ago