当前位置:网站首页>qrcode:将文本生成二维码
qrcode:将文本生成二维码
2022-07-05 02:43:00 【13少啊】
一.使用的方法
1.安装 yarn add qrcode或者npm i qrcode
2.导入 import Qrcode from 'qrcode'
3.定义一个canvas标签放二维码
<canvas ref="canvas" />
4.生成
Qrcode.toCanvas(需要放置二维码的canvas标签,文本内容,{配制,宽度,高度....})
二.实际操作
(1)下载
(2)导入
import Qrcode from 'qrcode'
(3)定义一个canvas标签放二维码
<canvas ref="canvas" > </canvas>
(4)生成
<template>
<div class="">
<canvas ref="canvas" >
</canvas >
<el-button @click="fn" type="primary" >点击生成</el-button>
</div>
</template>
<script>
import Qrcode from 'qrcode'
export default {
name: '',
methods: {
fn(){
Qrcode.toCanvas(this.$refs.canvas,'https://www.baidu.com/',{width:500,height:500})
}
}
}
</script>
<style scoped>
</style>
点击扫码就可以进入百度网页了。
边栏推荐
- 看 TDengine 社区英雄线上发布会,听 TD Hero 聊开发者传奇故事
- A label making navigation bar
- Pytest (4) - test case execution sequence
- Apache build web host
- GFS分布式文件系统
- Summary and practice of knowledge map construction technology
- Sqoop安装
- Yyds dry goods inventory intelligent fan based on CC2530 design
- PHP cli getting input from user and then dumping into variable possible?
- CAM Pytorch
猜你喜欢
Apache Web page security optimization
Asynchronous and promise
[200 opencv routines] 99 Modified alpha mean filter
A label making navigation bar
Open source SPL optimized report application coping endlessly
Openresty ngx Lua Execution stage
Bert fine tuning skills experiment
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Azkaban安装部署
Avoid material "minefields"! Play with super high conversion rate
随机推荐
Use the difference between "Chmod a + X" and "Chmod 755" [closed] - difference between using "Chmod a + X" and "Chmod 755" [closed]
8. Commodity management - commodity classification
[机缘参悟-38]:鬼谷子-第五飞箝篇 - 警示之一:有一种杀称为“捧杀”
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Yolov5 model training and detection
Idea inheritance relationship
Yolov5 model training and detection
The database and recharge are gone
openresty ngx_lua执行阶段
Structure of ViewModel
低度酒赛道进入洗牌期,新品牌如何破局三大难题?
A label making navigation bar
使用druid连接MySQL数据库报类型错误
Application and Optimization Practice of redis in vivo push platform
Watch the online press conference of tdengine community heroes and listen to TD hero talk about the legend of developers
Good documentation
Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
Icu4c 70 source code download and compilation (win10, vs2022)
Variables in postman
Single line function*