installation:
npm install qrcodejs2 --save
or Taobao mirror
asl install -g cnpm --registry = https: //registry.npm.taobao.org 再
cnpm install qrcodejs2 --save
Introduction:
<script> import QRCode from 'qrcodejs2' export default { data () { return { } }, created () { this.$nextTick(function () { this.bindQRCode(); }) }, methods: { bindQRCode: function () {new QRCode(this.$refs.qrCodeDiv, { text: 'www.baidu.com', width: 200, height: 200 is , colorDark: " # 333333 " , // the two-dimensional color code colorLight: " #FFFFFF " , // two-dimensional code background color correctLevel: QRCode.CorrectLevel.L // fault rate, L / M / H }) } } } </ Script >
Renderings:
Reference Links: https://www.cnblogs.com/ajuan/p/10100931.html
https://www.baidu.com