我网上搜了一下,说window.URL.createObjectURL(res)
可以但是没有效果
fetchData() {
const id = this.$route.query.companyId
getCusInfo(id).then(res => {
const _data = res.data
this.detail = _data
getFileDetail(_data.adAvatar).then(res => {
// const blob = new Blob([res.data], { type: 'image/png' })
// const url = window.URL.createObjectURL(blob)
// this.brandLogoUrl = url
const src = window.URL.createObjectURL(res)
this.brandLogoUrl = src
console.log('res', res)
})
console.log('brandLogoUrl', this.brandLogoUrl)
})
},
<el-form-item label="广告头像" prop="adAvatar">
<el-upload
class="avatar-uploader"
action="#"
:http-request="advertiserUpload2"
:show-file-list="false"
>
<img v-if="adAvatarUrl" :src="adAvatarUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon" />
</el-upload>
</el-form-item>
我暂时是这么处理的
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…