赞
踩
用户通过点击其他按钮触发的事件,来触发 Upload 组件的按钮实现的选择文件并上传的功能
<el-button>
是一个组件,查找到该节点之后,没有模拟点击 click 的函数,该组件并不是原生的DOM 节点
该组件有个 $el 属性,代表的就是原生DOM节点
<el-upload v-show="!scope.row.fileId"
:show-file-list="false"
class="upload-demo"
:action="'/aaa/upload?CId=' + scope.row.cid"
:data="{CId: scope.row.cid}"
name="file"
:on-success="fileChangeAction.bind(this,scope)">
<el-button type="default" :ref='scope.row.cid'>上传文件</el-button>
</el-upload>
<el-button type="link" size="small" @click="resetSummary(scope.row)">更改总结</el-button>
// 重置总结
resetSummary: function (rowData) {
let cid = rowData.cid
let uploadBtnRef = this.$refs[cid]
uploadBtnRef.$el.click()
},
:action="'/aaa/upload?CId=' + scope.row.cid"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。