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