[new feature] Uploader: add name prop (#3096)

This commit is contained in:
neverland
2019-04-04 19:46:37 +08:00
committed by GitHub
parent e9222fc6f7
commit 709848d745
6 changed files with 98 additions and 9 deletions
+24 -4
View File
@@ -29,7 +29,26 @@ export default {
};
```
#### Set input attr
#### Name
```html
<van-uploader name="uploader" :after-read="onRead">
<van-icon name="photograph" />
</van-uploader>
```
```javascript
export default {
methods: {
onRead(file, detail) {
this.$toast(detail.name);
}
}
};
```
#### Set input attrs
You can set native properties such as `accpet`、`multiple` on Uploader, and the input will automatically inherits the attribute.
```html
@@ -42,6 +61,7 @@ You can set native properties such as `accpet`、`multiple` on Uploader, and the
| Attribute | Description | Type | Default |
|------|------|------|------|
| name | Input name | `String` | - |
| result-type | Type of file read result, can be set to `dataUrl` `text` | `String` | `dataUrl` |
| accept | Accepted file type | `String` | `image/*` |
| disabled | Whether to disabled the upload | `Boolean` | `false` |
@@ -61,9 +81,9 @@ You can set native properties such as `accpet`、`multiple` on Uploader, and the
|------|------|
| - | Custom icon |
### afterRead Parematers
### Parematers of before-read、after-read
| Attribute | Description | Type |
|------|------|------|
| file | file object | `Object` |
| content | file content | `String` |
| file | File object | `Object` |
| detail | Detail info | `Object` |