element-ui 中 upload组件 如何传递额外的参数 ?
【代码】element-ui 中 upload组件 如何传递额外的参数?
·
参考elementui 文档
如何通过data 进行额外传递参数?(:data="uploadData"
)
<el-upload
ref="fileUploadBtn1"
class="upload-demo"
accept=".xls,.xlsx"
:limit="1"
:action="uploadFileUrl"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:data="uploadData"
:show-file-list="false">
<el-button size="medium" type="primary">导入</el-button>
</el-upload>
data(){
return{
uploadData: {
seId: "",
},
}
},
method(){
/* 文件上传之前将参数赋值 */
beforeAvatarUpload(file) {
const _vm = this;
_vm.uploadData.seId = this.form.id;
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)