当前位置:网站首页>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()
}
})边栏推荐
- QT notes - custom data types
- Optimization method of "great mathematics for use" -- optimal design of Cascade Reservoir Irrigation
- How to realize the function of grabbing red envelopes in IM system?
- Source code analysis sentry user behavior record implementation process
- The biggest crisis for testers in the workplace is not at the age of 30, but being laid off in middle age
- Buckle exercise - 35 combination sum II
- 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
- 【C和指针第11章】动态内存分配
- QT | summary of the use of edit box
- [C and pointer Chapter 14] preprocessor
猜你喜欢

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

One of his birds sold for 60million -- the collection of eight mountain people in the Ming and Qing Dynasties

Qt5.12 + vs2019 cannot locate the program input point in the dynamic link library

【网络空间安全数学基础第3章】同余

在kuborad图形化界面中,操作Kubernetes 集群,实现mysql中的主从复制

How to find out the function calling process of complex code running as soon as possible

Source code analysis sentry user behavior record implementation process

三层交换机配置MSTP协议详解【华为eNSP实验】
![Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]](/img/ee/e0770298d0534014485145c434491a.png)
Detailed explanation of MSTP protocol for layer 3 switch configuration [Huawei ENSP experiment]

Day3: branch structure
随机推荐
Time processing of basic library in go
QT notes - EventFilter event filter
The difference between synchronized and lock locks
NFT digital collection system construction - app development
[function test] test of the project - login and post function
02 linear structure 2 multiplication and addition of univariate polynomials (linked list solution)
Skillfully using command line parameters in Delphi to realize the trigger function of dragging files onto program icons
C Advanced - data storage
Understand what goals the MES system can achieve
[mathematical basis of Cyberspace Security Chapter 3] congruence
Dry goods sharing - taking over a new data team as a lead - Problem Inventory and insights findings
三、MFC消息映射机制实现原理
[I also want to brush through leetcode] 468. Verify the IP address
QT notes - custom data types
Acwing 92. recursive implementation of exponential enumeration
js图像转base64
L2-011 play with binary tree
Common shortcuts to VIM editor
容错、熔断的使用与扩展
[leetcode]- linked list-3