vue 與qrcodejs2 生成的二維碼 logo 居中


  代碼:
<div class="qrcode" >
      <img src="圖片地址" v-if="iconIMGurl==='0'?false:true"  class="logoimg"/>
      <div ref="qrcode" id="qrcode">
      </div>
    </div>
 
 
style:
.qrcode{
  display:inline-block;
  position:relative;margin-top: .2rem;
}
.logoimg{
    position:absolute;
    left:50%;
    top:50%;
    width:60px;
    height:60px;
    margin-top:-30px;
    margin-left:-30px;
}
 
 
js:
import QRcode from 'qrcodejs2'   //引入
qrcode() {
      this.qrcode = new QRcode('qrcode', {
        width: 200, // 設置寬度,單位像素
        height: 200, // 設置高度,單位像素
        text: this.QRtext, // 設置二維碼內容或跳轉地址
        colorDark: this.erweiCodeColor // 二維碼的顏色
      })
    }
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM