vant组件上传文件的使用
2020-08-13 18:33
711 查看
因为:after-read="beforeRead"写错了,应该是after-read,文件读取完成后的回调函数,但是我刚开始写成了before-read,这是(文件读取前的回调函数,返回 false 可终止文件读取,支持返Promise)vant组件里面的,搞了好半天才出来。一定要细心。
<div class="uploderloding"> <label for="">上传附件:</label> <van-uploader accept="image/*,.pdf,.doc.,rar,.zip,.docx" v-model="fileList" :after-read="beforeRead"> <van-button icon="upgrade" type="default">上传文件</van-button> </van-uploader> <p style="margin-left: 5.4em;">支持扩展名:.rar .zip .doc .docx .pdf .jpg...</p> </div>
beforeRead (file,detail) { const abcd = file.abc = 1 console.log(file,'detail',detail) if (abcd == 1) { file.status = 'uploading'; file.message = '上传中...'; setTimeout(() => { file.status = 'done'; file.message = '上传成功'; vant.Toast(file.message); }, 1000); clearTimeout() }else{ file.status = 'uploading'; file.message = '上传中...'; setTimeout(() => { file.status = 'failed'; file.message = '上传失败'; }, 1000); } // return file,detail; },
相关文章推荐
- 使用FileUpload组件上传文件
- 使用FileUpload组件上传文件
- asp.net中Fine Uploader文件上传组件使用介绍
- 使用FileUpload组件上传文件
- 使用fileupload组件实现文件上传
- 使用SmartUpload组件实现文件上传
- 使用COS组件实现文件上传
- 在jsp中使用smartupload组件上传文件- -
- 使用swfupload上传超过30M文件,使用FLASH上传组件
- 使用jspSmartUpload组件进行文件上传、下载
- jsp中使用第三方组件实现文件上传
- 使用SmartUpload组件实现文件上传
- 使用SmartUpload组件实现文件上传
- 【要什么自行车】ASP.NET MVC4笔记02:上传文件 uploadify 组件使用
- JAVA commons-fileupload文件上传组件使用说明
- 在jsp中使用smartupload组件上传文件
- O'Reilly cos上传组件的使用(1/3) - 上传文件
- 在jsp中使用smartupload组件上传文件---http://dev.csdn.net/develop/article/18/18987.shtm
- 使用commons组件上传文件
- 使用FileUpload组件上传文件