<el-upload action='' :on-change="getFile" :limit="1" :auto-upload="false"
ref="faceImgUpload03">
<div>
<img :src="dataForm.logoUrl" width="150px" height="150px"/>
</div>
<el-button type="warning" plain size="mini" style="margin-top: 20px">上传本地图片</el-button>
</el-upload>
//获取图片的base64
getFile (file, fileList) {
this.getBase64(file.raw).then(res => {
this.dataForm.logoUrl = 'data:image/jpg;base64,' + res.split(',')[1]
})
this.showCameraDetail = false
this.$refs['faceImgUpload03'].clearFiles()
},
getBase64 (file) {
return new Promise(function (resolve, reject) {
let reader = new FileReader()
let imgResult = ''
reader.readAsDataURL(file)
reader.onload = function () {
imgResult = reader.result
}
reader.onerror = function (error) {
reject(error)
}
reader.onloadend = function () {
resolve(imgResult)
}
})
},