[new feature] Uploader: add name prop (#3096)
This commit is contained in:
@@ -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` |
|
||||
|
||||
Reference in New Issue
Block a user