vue send a link turn two-dimensional code

Use qrcodejs2 plug

1. Install qrcodejs2 : npm install qrcodejs2 --save

2. In the assembly which is introduced: import QRCode from 'qrcodejs2'

3. 在HTML加入:<div id="qrcode" ref="qrcode"></div>

4. Method:

qrcode () { 
 the let QRCode qrcode new new = ( 'qrcode', { 
 width: 200 is, // set the width in pixels 
 height: 200, // set the height in pixels 
 text: 'https://www.baidu.com' // set two-dimensional code or a jump address contents 
}) 
}

 5. Call: the this . Qrcode ()

 

Guess you like

Origin www.cnblogs.com/licurry/p/11243354.html