qrcodejs2-npm: https://www.npmjs.com/package/qrcodejs2
1. 安装
npm i qrcodejs2
2. 组件中引入并封装成公共组件
<template>
<div style="width: 100%;height: 100%;" :id="id" :ref="id"></div>
</template>
<script>
import QRCode from 'qrcodejs2'
export default {
data() {
return {
qrcode: ''
}
},
props: {
id: {
type: String,
required: true
},
text: { // 后端返回的二维码地址
type: String,
default: 'http://jindo.dev.naver.com/collie&