[new feature] Uploader: add max-count prop

This commit is contained in:
陈嘉涵
2019-06-04 15:53:19 +08:00
parent 03af04e81e
commit 47bb6fc7fa
8 changed files with 98 additions and 11 deletions
+18 -1
View File
@@ -12,6 +12,8 @@ Vue.use(Uploader);
### 基础用法
图片上传完毕后会触发`after-read`传入的回调函数,获取到对应的`file`对象
```html
<van-uploader preview :after-read="onRead" />
```
@@ -26,8 +28,22 @@ export default {
};
```
### 上传数量限制
通过`max-count`属性可以限制上传图片的数量。上传数量达到限制后,会自动隐藏上传区域
```html
<van-uploader
preview
multiple
:max-count="2"
/>
```
### 自定义上传样式
通过插槽可以自定义上传区域的样式
```html
<van-uploader :after-read="onRead">
<van-button icon="photo" type="primary">上传图片</van-button>
@@ -49,6 +65,7 @@ export default {
| before-read | 文件读取前的回调函数,返回`false`可终止文件读取 | `Function` | - | - |
| after-read | 文件读取完成后的回调函数 | `Function` | - | - |
| max-size | 文件大小限制,单位为`byte` | `Number` | - | - |
| max-count | 图片上传数量限制 | `Number` | - | 2.0.0 |
| result-type | 文件读取结果类型,可选值为`text` | `String` | `dataUrl` | - |
| upload-text | 上传区域文字提示 | `String` | - | 2.0.0 |
@@ -56,7 +73,7 @@ export default {
| 事件名 | 说明 | 回调参数 |
|------|------|------|
| oversize | 文件大小超过限制时触发 | 同 after-read |
| oversize | 文件大小超过限制时触发 | 同`after-read` |
### Slots