H5-生成二维码
2024-10-21 06:36:23
<div class="poster-qr">
<div class="qrWrapper">
<!-- 放置二维码的容器 -->
<div id="qrcode" ref="qrcode" class="qrcode"/>
</div>
<div class="qrDesc">长按扫描二维码领取</div>
</div>
import QRCode from 'qrcodejs2'
export default {
name: 'SharePoster',
components: { QRCode },
data() {
return {}
},
mounted() {
this.$nextTick(() => {
this.qrcode('http://www.baidu.com') // 二维码的内容,由后端返回链接
})
},
methods: {
// 生成二维码
qrcode(url) {
new QRCode(window.document.getElementById('qrcode'), {
width: window.document.getElementById('qrcode').offsetWidth,
height: window.document.getElementById('qrcode').offsetHeight,
text: url,
colorDark: '#000',
colorLight: '#fff',
correctLevel: QRCode.CorrectLevel.H
})
}
}
最新文章
- linux服务器使用
- mac 设置 git 和github 告别命令行
- 关于SQLSERVER联合查询一点看法
- XML转换为对象操作类详解
- http://www.roncoo.com/article/detail/124822
- 关于Java中的程序,进程和线程的详解...
- poj3368Frequent values(RMQ)
- css-position的相关用法
- ortp使用详解1
- 20170717_python爬虫之requests+cookie模拟登陆
- 更为复杂C程序的运行时结构
- odoo开发笔记 -- 模型字段定义中设置默认值
- Winform实现多线程异步更新UI(进度及状态信息)
- Django(十)COOKIE和session
- Qt__绘制系统
- container_of使用小结
- 如何通过DataGridView 实现单元格合并和二维表头
- [控件] TranformFadeView
- flask的第一个例子
- Node JVM