Brief Tutorial
qrious is a pure JS QR code generation plug-in based on HTML5 Canvas. Various QR codes can be quickly generated through qrious.js. You can control the size and color of the QR code, and you can also Base64 encode the generated QR code.
Installation
You can install the qrious.js QR code plug-in through bower or npm.
$ npm install --save qrious $ bower install --save qrious
How to use
To use this QR code generation plug-in, you need to introduce the qrious.js file into the page.
<script type="text/javascript" src="js/qrious.js"></script>
HTML structure
Use a
<canvas id="qr"></canvas>
Initialization plug-in
You can instantiate an object instance through the QRious() method.
(function() { const qr = new QRious({ element: document.getElementById('qr'), value: 'http://www.htmleaf.com/' }) })()
If you use it in Node.js, the code is as follows:
const express = require('express') const QRious = require('qrious') const app = express() app.get('/qr', (req, res) => { const qr = new QRious({ value: 'http://www.htmleaf.com/' }) res.end(new Buffer(qr.toDataURL(), 'base64')) }) app.listen(3000)
Configuration parameters
The available configuration parameters of qrious.js QR code plug-in are as follows:
For example:
const qr = new QRious() qr.background = '#000' qr.foreground = '#fff' qr.level = 'H' qr.size = 500 qr.value = 'http://www.htmleaf.com/'
Or pass it in the constructor:
const qr = new QRious({ background: '#000', foreground: '#fff', level: 'H', size: 500, value: 'http://www.htmleaf.com/' })
You can set the QR code used to generate the QR code in the element parameter DOM element. The DOM element must be a
const qr = new QRious({ element: document.querySelector('canvas'), value: 'http://www.htmleaf.com/' }) qr.canvas.parentNode.appendChild(qr.image)
toDataURL([mime]) method
The toDataURL([mime]) method can generate the URI of the Base64 encoded data of the QR code. If you do not specify a MIME Type, the default value will be used as the mime type.
const qr = new QRious({ value: 'http://www.htmleaf.com/' }) console.log(qr.toDataURL()) //=> "data:image/png;base64,iVBOR...AIpqDnseH86KAAAAAElFTkSuQmCC" console.log(qr.toDataURL('image/jpeg')) //=> "data:image/jpeg;base64,/9j/...xqAqIqgKFAAAAAq3RRQAUUUUAf/Z"
The above is the content. For more related content, please pay attention to the PHP Chinese website (www.miracleart.cn)!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

1. Open the software and enter the wps text operation interface. 2. Find the insert option in this interface. 3. Click the Insert option and find the QR code option in its editing tool area. 4. Click the QR code option to pop up the QR code dialog box. 5. Select the text option on the left and enter our information in the text box. 6. On the right side, you can set the shape of the QR code and the color of the QR code.

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ??and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

What should I do if the QR code on Enterprise WeChat cannot be loaded? What should we do when we find that the QR code cannot be loaded and cannot be displayed when logging into the computer version of Enterprise WeChat? Here, the editor will give you a detailed introduction to the solution to the problem that the QR code of Enterprise WeChat cannot be loaded. Anyone who needs it Friends, come and take a look! Method 1. Network reasons 1. The network speed may be slow, resulting in slow loading and failure to display. You can disconnect and reconnect. 2. Check the computer's own network problems to see if it is connected to the network. You can restart the network device. Method 2: Maintenance and update: The QR code may not be generated because the version of Enterprise WeChat is too low. You can upgrade the software to the latest version. Method three, firewall 1

Explore the Canvas framework: To understand what are the commonly used Canvas frameworks, specific code examples are required. Introduction: Canvas is a drawing API provided in HTML5, through which we can achieve rich graphics and animation effects. In order to improve the efficiency and convenience of drawing, many developers have developed different Canvas frameworks. This article will introduce some commonly used Canvas frameworks and provide specific code examples to help readers gain a deeper understanding of how to use these frameworks. 1. EaselJS framework Ea

The relationship between js and vue: 1. JS as the cornerstone of Web development; 2. The rise of Vue.js as a front-end framework; 3. The complementary relationship between JS and Vue; 4. The practical application of JS and Vue.

Understand the power and application of canvas in game development Overview: With the rapid development of Internet technology, web games are becoming more and more popular among players. As an important part of web game development, canvas technology has gradually emerged in game development, showing its powerful power and application. This article will introduce the potential of canvas in game development and demonstrate its application through specific code examples. 1. Introduction to canvas technology Canvas is a new element in HTML5, which allows us to use

How to open the QR code of Tencent Video? There is an exclusive QR code for the login account in Tencent Video, but most users do not know how to open the QR code. Next, the editor brings users how to open the QR code of Tencent Video. Graphic tutorial, interested users come and take a look together! Tencent Video usage tutorial How to open Tencent Video QR code 1. First open the Tencent Video APP and click [Personal Center] at the bottom of the main page; 2. Then enter the Personal Center interface and select [Click to log in]; 3. Finally jump Come out of the small window and click the QR code button in the upper left corner to scan and log in.

1. Download the latest version of DingTalk. 2. Click the avatar in the upper left corner. 3. Click the avatar in the upper right corner. 4. Select the QR code business card. 5. Choose face-to-face exchange.
