vue中的图片渲染,长宽为0

由于加载dom的时候,先加载了img标签,但是由于图片是从服务器上加载的,加载的速度比较慢,没有实际的url地址,导致图片的宽高为0.
let that = this
this.imgUrl = this.outerNet ? ${this.baseURL}/rec/home/out/official/download/oss/flie/${file.response} : ${this.baseURL}/rec/manage/recruit/common/show/oss/image/${file.response}
const myImage = new Image()
myImage.src = this.imgUrl
myImage.onload = () => {
that.$nextTick(() => {
that.dialogVisible = true
})
}

你可能感兴趣的:(vue中的图片渲染,长宽为0)