码迷,mamicode.com
首页 > 其他好文 > 详细

使用element-ui中的el-upload组件时携带其他参数

时间:2020-07-04 17:01:24      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:parent   ref   ade   文件   type   exce   回调函数   style   limit   

<el-upload
        class="upload-demo"
        ref="upload"  
        :action="uploadURL+‘/customer/excel‘"   //后台接口(接受上传的文件并做后端的逻辑处理)
        :headers="headers"
        accept=".xlsx,.xls"  // 限制文件格式
        :on-preview="handlePreview"
        :on-remove="handleRemove"
        :on-success="handleSuccess" //上传文件成功时的回调函数
        :file-list="fileList"
        :limit="1"  // 限制文件个数
        :data="uploadData"   //上传文件时要上传的额外参数
        :on-exceed="handleExceed"
        :auto-upload="false">  //停止文件自动上传模式
        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
 </el-upload>

 data中

export default {
 data() {
    uploadData:{name: this.$parent.name}  
    // name为java后台需要接收的数据,
this.$parent.name则是获取父组件的name
  } 
}

 

使用element-ui中的el-upload组件时携带其他参数

标签:parent   ref   ade   文件   type   exce   回调函数   style   limit   

原文地址:https://www.cnblogs.com/gnh96/p/13235276.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!