vue element上传

复制代码
 <el-upload
                class="upload"
                :action="actions"
                :headers="headers"
                :on-preview="handlePreview"
                :on-remove="handleRemove"
                :before-remove="beforeRemove"
                :on-success="handlesuccess"
                multiple
                :limit="1"
                :on-exceed="handleExceed"
                :file-list="fileList">

                <el-button size="small" type="primary" icon="el-icon-upload"> 批量上传</el-button>
              </el-upload>
复制代码
this.actions=`${process.env.VUE_APP_BASE_API }/iot/api.iot/v1/water-record/${this.activeName }/excel`

this.headers= {
        Authorization:getToken()
      }

设置actions 设置headers

show-file-list这个属性控制是否显示下面的东西。

理论上文档中需要的功能都有,只是可能没理解文档的说明

https://element.eleme.cn/#/zh-CN/component/upload

posted @   前端路远且长  阅读(34)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
点击右上角即可分享
微信分享提示