1<Upload 2 ref="upload" 3 action="/api/book/excel/import" 4 name="excel-file" 5 :show-upload-list="true" 6 :on-format-error="handleFormatError" 7 :on-success="handleSuccess" 8 :on-error="handleError" 9 :format ="['xlsx','xls']"> 10 <Button type="info" icon="ios-cloud-upload-outline">批量导入</Button> 11 </Upload> 12 13 handleFormatError(file){ 14 this.$Notice.warning({ 15 title: '文件格式不正确', 16 desc: '文件 ' + file.name + ' 格式不正确,请上传.xls,.xlsx文件。' 17 }) 18 }, 19 handleSuccess(res,file){ 20 if(res.errcode === 0){ 21 this.dialoLead = false 22 this.$Message.success("数据导入成功!") 23 this._getBookList() 24 this.$refs.upload.clearFiles() 25 } 26 }, 27 handleError(error,file){ 28 this.$Message.error("数据导入失败!") 29 },
vue iview 导入excel文件(upload)
Easter79
2021-10-12
1409 2 0
点赞
收藏
评论区
加载中...