api 修改

This commit is contained in:
taiyong 2017-03-24 16:47:23 +08:00
parent c7a9cf0521
commit 2fa959f31f
3 changed files with 6 additions and 4 deletions

View File

@ -21,7 +21,7 @@ export default {
<div class="uploader-container">
<zan-uploader
:before-read="logContent"
@file-readed="logContent">
:after-read="logContent">
</zan-uploader>
</div>
```
@ -30,7 +30,7 @@ export default {
:::demo 自定义上传图标
```html
<div class="uploader-container">
<zan-uploader @file-readed="logContent">
<zan-uploader :after-read="logContent">
<zan-icon name="photograph"></zan-icon>
</zan-uploader>
</div>
@ -45,7 +45,7 @@ export default {
| result-type | 读取文件的方式以base64的方式读取以文本的方式读取 | `string` | `dataUrl` | `dataUrl`, `text` |
| disable | 是否禁用上传,在图片上传期间设置为true禁止用户点击此组件上传图片 | `boolean` | `false` | |
| before-read | 读文件之前的钩子,参数为选择的文件,若返回 false 则停止读取文件。 | `Function` | | |
| file-readed | 文件读完之后出发此事件,参数为{name:'文件名',type:'文件类型',size:'文件大小',content:'读的内容'} | `Function` | | |
| after-read | 文件读完之后回调此函数,参数为{name:'文件名',type:'文件类型',size:'文件大小',content:'读的内容'} | `Function` | | |
### Slot

View File

@ -18,6 +18,7 @@
default: false
},
beforeRead: Function,
afterRead: Function,
resultType: {
type: String,
default: 'dataUrl',
@ -37,7 +38,7 @@
if (this.beforeRead && !this.beforeRead(file)) return;
var reader = new FileReader();
reader.onload = (e) => {
this.$emit('file-readed',
this.afterRead && this.afterRead(
{
name: file.name,
type: file.type,

1
zanui-vue Symbolic link
View File

@ -0,0 +1 @@
zanui-vue