欢迎访问 生活随笔!

生活随笔

当前位置: 首页 >

antdesignvue upload vue3个人笔记待更新

发布时间:2023/12/13 58 豆豆
生活随笔 收集整理的这篇文章主要介绍了 antdesignvue upload vue3个人笔记待更新 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
remove点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除。Function(file): boolean | Promise
beforeUpload上传文件之前的钩子,参数为上传的文件,若返回 false 则停止上传。支持返回一个 Promise 对象,Promise 对象 reject 时则停止上传,resolve 时开始上传( resolve 传入 File 或 Blob 对象则上传 resolve 传入对象)。注意:IE9 不支持该方法(file, fileList) => boolean | Promise
<a-upload multiple :remove="handleRemove" :beforeUpload="beforeUpload" :fileList="fileList"><a-button> 上传文件</a-button> </a-upload> // 文件多选删除文件操作handleRemove(file: FileInfo) {const index = this.fileList.indexOf(file);const newFileList = this.fileList.slice();newFileList.splice(index, 1);this.fileList = newFileList;},beforeUpload(file: FileInfo) {this.fileList = [...this.fileList, file];return false;},

 

总结

以上是生活随笔为你收集整理的antdesignvue upload vue3个人笔记待更新的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。