mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
api 修改
This commit is contained in:
parent
c7a9cf0521
commit
2fa959f31f
@ -21,7 +21,7 @@ export default {
|
|||||||
<div class="uploader-container">
|
<div class="uploader-container">
|
||||||
<zan-uploader
|
<zan-uploader
|
||||||
:before-read="logContent"
|
:before-read="logContent"
|
||||||
@file-readed="logContent">
|
:after-read="logContent">
|
||||||
</zan-uploader>
|
</zan-uploader>
|
||||||
</div>
|
</div>
|
||||||
```
|
```
|
||||||
@ -30,7 +30,7 @@ export default {
|
|||||||
:::demo 自定义上传图标
|
:::demo 自定义上传图标
|
||||||
```html
|
```html
|
||||||
<div class="uploader-container">
|
<div class="uploader-container">
|
||||||
<zan-uploader @file-readed="logContent">
|
<zan-uploader :after-read="logContent">
|
||||||
<zan-icon name="photograph"></zan-icon>
|
<zan-icon name="photograph"></zan-icon>
|
||||||
</zan-uploader>
|
</zan-uploader>
|
||||||
</div>
|
</div>
|
||||||
@ -45,7 +45,7 @@ export default {
|
|||||||
| result-type | 读取文件的方式,以base64的方式读取;以文本的方式读取 | `string` | `dataUrl` | `dataUrl`, `text` |
|
| result-type | 读取文件的方式,以base64的方式读取;以文本的方式读取 | `string` | `dataUrl` | `dataUrl`, `text` |
|
||||||
| disable | 是否禁用上传,在图片上传期间设置为true,禁止用户点击此组件上传图片 | `boolean` | `false` | |
|
| disable | 是否禁用上传,在图片上传期间设置为true,禁止用户点击此组件上传图片 | `boolean` | `false` | |
|
||||||
| before-read | 读文件之前的钩子,参数为选择的文件,若返回 false 则停止读取文件。 | `Function` | | |
|
| before-read | 读文件之前的钩子,参数为选择的文件,若返回 false 则停止读取文件。 | `Function` | | |
|
||||||
| file-readed | 文件读完之后出发此事件,参数为{name:'文件名',type:'文件类型',size:'文件大小',content:'读的内容'} | `Function` | | |
|
| after-read | 文件读完之后回调此函数,参数为{name:'文件名',type:'文件类型',size:'文件大小',content:'读的内容'} | `Function` | | |
|
||||||
|
|
||||||
### Slot
|
### Slot
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
beforeRead: Function,
|
beforeRead: Function,
|
||||||
|
afterRead: Function,
|
||||||
resultType: {
|
resultType: {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'dataUrl',
|
default: 'dataUrl',
|
||||||
@ -37,7 +38,7 @@
|
|||||||
if (this.beforeRead && !this.beforeRead(file)) return;
|
if (this.beforeRead && !this.beforeRead(file)) return;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
this.$emit('file-readed',
|
this.afterRead && this.afterRead(
|
||||||
{
|
{
|
||||||
name: file.name,
|
name: file.name,
|
||||||
type: file.type,
|
type: file.type,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user