当前位置:网站首页>qrcode-----生成二维码
qrcode-----生成二维码
2022-08-10 08:22:00 【cc&】
1.安装插件
npm i qrcode
2.基本用法
// 基本用法
import QrCode from 'qrcode'
// dom为一个canvas的dom对象, info为转化二维码的信息
QrCode.toCanvas(dom, info)
3.实例
表现部分(html)canvas是图像标签
<!-- 二维码弹框 -->
<el-dialog title="二维码" :visible.sync="codeDialogVisible" width="20%">
<el-row type="flex" justify="center">
<canvas ref="myCanvas" />
</el-row>
</el-dialog>
js实现部分
//最上方引入
import QrCode from 'qrcode'
// 二维码弹框打开
openCode(url) {
if (!url) return // 有图片才显示弹层
this.codeDialogVisible = true
this.$nextTick(() => {
QrCode.toCanvas(this.$refs.myCanvas, url)
})
},
this.$nextTick()没有的话会报错
边栏推荐
- 组合数模板
- 【一起学Rust | 进阶篇 | RMQTT库】RMQTT消息服务器——安装与集群配置
- Obtain - 65 [chances] : "soldiers, subtlety also - 7-36 meter reading - defeat
- 同步锁synchronized追本溯源
- Ask next CDC mysql to Doris. Don't show the specific number of lines, how to do?
- Add spark related dependencies and packaging plugins (sixth bullet)
- Rust learning: 6.4_ enumeration of composite types
- Is the write performance of raid5 faster than raid10?
- FFT模板
- CV+Deep Learning——网络架构Pytorch复现系列——classification(三:MobileNet,ShuffleNet)
猜你喜欢
Solve the problem that the win10win7win8 system cannot find the specified module and cannot register the desert plug-in
PHP笔记 28 29 30 31
机器人控制器编程实践指导书旧版-实践二 传感器(模拟量)
How AliExpress sellers seize product search weight
PLSQL学习第一天
如何远程调试对方的H5页面
一文2600字手把手教你编写性能测试用例
卷积神经网络卷积层公式,卷积神经网络运算公式
二叉树 --- 堆
每日一题,数组字符串的匹配问题
随机推荐
短视频同城流量宣传小魔推有何优势?如何给实体商家带来销量?
foreach遍历删除元素问题总结
【Unity入门计划】Collision2D类&Collider2D类
winget包管理器
[In-depth study of 4G/5G/6G topic-56]: L3 signaling control-5-radio bearer management
2022-08-01 网工进阶(二十三) VLAN高级技术-VLAN聚合、MUX VLAN
初使jest 单元测试
PHP笔记 28 29 30 31
phpstudy开机自启
m.bjhjwy.com全面教学设备 类型包括: 教学仪器, 教学设备 ,
Rust学习:6.4_复合类型之枚举
Quickly enter the current date and time
卷积神经网络卷积层公式,卷积神经网络运算公式
[Learn Rust together | Advanced articles | RMQTT library] RMQTT message server - installation and cluster configuration
【Unity入门计划】2D游戏实现敌人来回移动控制脚本
VS2013-调试汇编代码-生成asm文件-结构体内存布局-函数参数压栈-调用约定
【业务架构】价值链分析:提高客户价值和盈利能力
Solve the problem that the win10win7win8 system cannot find the specified module and cannot register the desert plug-in
Johnson全源最短路
raid5的写性能,是不的比raid10快一些?