base64地址格式的图片,从新窗口打开&&使用window.open打开新的页面并修改样式添加内容

图片地址

let imgUrl='data:imgage/png,base64,ivbodenjko X AE E64 GAASUEAA-AAYAAACAAMRFM AATEDAAAAEAABAAEACBOAMAEDA512SAUAAAEXEIFTkSu0mCC”
 getClick() {
    
    
      if (this.imgUrl) {
    
    
        const img = new Image()
        img.src = this.imgUrl
        const newWin = window.open('', '_blank')
        newWin.document.write(img.outerHTML)
        newWin.document.body.style.background = '#000';
        newWin.document.body.style.marginLeft = '0px';
        newWin.document.body.style.height = '100%';
        newWin.document.body.style.marginTop = '20px';
        newWin.document.body.style.marginRight = '0px';
        newWin.document.body.style.marginBottom = '0px';
        newWin.document.body.style.textAlign = 'center';
        newWin.document.close()
      }
    },

猜你喜欢

转载自blog.csdn.net/Maxueyingying/article/details/131596726