- 代码
<el-upload
ref="schoolLogo"
class="avatar-uploader"
action="https://jsonplaceholder.typicode.com/posts/"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar" alt="">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
<el-button class="upload_pic" type="primary" @click="toSelectFile('schoolLogo')">上传图片</el-button>
methods:{
toSelectFile(refname) {
this.$refs[refname].$refs['upload-inner'].handleClick();
}
}
data自信补充或者看element ui官网
标签:button,refname,upload,ui,element,refs From: https://www.cnblogs.com/DnmyCourage/p/17914317.html