当前位置:网站首页>Wechat applet generates QR code
Wechat applet generates QR code
2022-07-24 12:19:00 【Chenqing Nuo language】
QR code is also called Two dimensional bar code , Common QR codes are QR Code,QR Full name Quick Response(Quick Response, It reflects that this QR code has “ Ultra high speed reading ” Characteristics .“Quick Response Code” That is to say “ Quick response code ”), It is a super popular coding method on mobile devices in recent years , It's better than the traditional Bar Code Barcode can store more information , Can also represent more data types .
Two dimensional bar code / QR code (2-dimensional bar code) It is to use a specific geometric figure in a plane according to a certain rule ( Two dimensional ) The distribution of the 、 Black and white 、 Graph recording data symbol information ; In code making, it is ingenious to use the “0”、“1” The concept of bitstream , A number of geometric shapes corresponding to binary are used to represent literal numerical information , adopt Image input device or photoelectric scanning device Automatic reading to realize automatic information processing : It has some common features of bar code technology : Each code system has its own specific character set ; Each character has a certain width ; It has certain verification function etc. . At the same time, it also has the function of automatic identification of different information 、 And processing the rotation change point of the graph .
development history
Two dimensional code principle
The basic principle of QR code is to use binary to store information . It usually consists of square matrix pixels . The following figure is a common shape of QR code . It consists of 21 That's ok ,21 A small rectangle of columns . Matrix " Black dot " For binary "1", " White dot " For binary "0". these 1 and 0 The arrangement and combination form a QR code .
except 1 and 0 Outside the pixels of , The QR code also has three large black blocks like eyes , be called Anchor point . This is used to locate the image during QR code recognition , There must be no shelter . Otherwise, it will not be recognized .
First introduce weapp-qrcode.js Download link Click on the link , direct ctrl + s Save relative position
wxml
<view id="container">
<view class="ewm">
<canvas style="width: 600rpx; height: 600rpx;" canvas-id="myQrcode"></canvas>
</view>
<input class="inpt" bindinput="ewmText" value="{
{ text }}"></input>
<button bindtap="searchFn" class="btn" type="primary"> Generate qr code </button>
</view>wxss
.ewm{
background-color: #e8e8e8;
display: flex;
justify-content: center;
align-items: center;
width: 680rpx;
height: 680rpx;
margin: 50rpx auto;
}
.inpt{
border: 1rpx solid #e8e8e8;
width: 620rpx;
margin: 30rpx auto;
padding: 30rpx;
}
.btn{
width: 680rpx;
}js
//index.js
const app = getApp()
let drawQrcode = require("../../utils/weapp-qrcode.js")
Page({
data: {
text:"(๑′ᴗ‵๑)I Lᵒᵛᵉᵧₒᵤ",
},
onLoad() {
this.ewmChange()
},
ewmChange(){
let size = {}
size.w = wx.getSystemInfoSync().windowWidth / 750 * 600
size.h = size.w
var that = this
drawQrcode({
width: size.w,
height: size.h,
canvasId: 'myQrcode',
// ctx: wx.createCanvasContext('myQrcode'),
text: that.data.text,
// v1.0.0+ Version supports drawing pictures on QR code
})
},
ewmText(e){
this.setData({
text: e.detail.value
})
},
searchFn(){
this.ewmChange()
}
})边栏推荐
- Open source DNS software powerdns BIND9 mydns
- 【网络空间安全数学基础第9章】有限域
- How to eliminate the character set and sorting rules specially set for fields in MySQL tables?
- makefile快速使用
- L1-059 敲笨钟
- Use and expansion of fault tolerance and fusing
- L2-011 play with binary tree
- Leecode-268. missing numbers (Application of XOR, find numbers that do not appear, find numbers that only appear once)
- Buckle practice - 31 effective tic tac toe games
- Please ask whether Oracle CDC does not support checkpointing. When the task is suspended and restarted during the real-time collection process, is the data changed
猜你喜欢

Design of digital oscilloscope based on arm and FPGA -- QMJ

【C和指针第14章】预处理器

Summary of MySQL database combined with actual SQL optimization of the project

C进阶——数据的存储

动态内存管理

Pushgateway installation and Prometheus configuration

SQL multi condition query cannot be implemented

4*4图片权重的收敛规则

3、 Implementation principle of MFC message mapping mechanism

With the strong development of cloud native, how should enterprises seize business opportunities
随机推荐
Blue team resource collection
STM32 - Fundamentals of C language
[rust] rust language foundation | you should quickly get an impression when learning a language
L2-011 玩转二叉树
makefile快速使用
Convergence rules for 4 * 4 image weights
[Commons beanautils topic] 005- convertutils topic
在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制
[rust] Why do I suggest you learn rust | a preliminary study of rust
Buckle practice - 24 remove repeated letters
【C和指针第14章】预处理器
JS image to Base64
Buckle practice - 31 effective tic tac toe games
微信公众号开发:素材管理(临时、永久)
Conference publishing function of conference OA project
TypeNameExtractor could not be found
Pushgateway installation and Prometheus configuration
如何将Typora中图片上传到csdn
One of his birds sold for 60million -- the collection of eight mountain people in the Ming and Qing Dynasties
[rust] what software should I use to develop rust? Recommended editors commonly used to support rust