iview upload组件的运用
写文件上传时,在网上看过很多关于upload组件文章,今天我就总结下自己运用upload组件的心得。 最有力的说明就是代码了,上代码 1.运用iview upload组件上传文件(带token,带参数) 1.1. 前端vue代码 1.组件<div style="align-items:center;display:flex;justify-content:flex-start;"> <Upload action="/myblog/mycontroller/mymethod" :headers="{'Authorization':token}" :data="fileData" :before-upload="onBefore" style="margin-left: 5px;"> <Button icon="ios-cloud-upload-outline"style="margin-top: 8px;" type="primary" size="large" >导入</Button> <!--<span v-if="file !== null" style="color:green;">{{ file.name }}</span>--> </Upload> </div>2.变量 data () { return { file:null,