npm i v-qrcode --save
<template>
<div>
<qrcode :cls="qrCls" :value="qrText"></qrcode>
</div>
</template>
<script>
import Qrcode from 'v-qrcode/src/index'
export default {
data () {
return {
qrCls: 'qrcode',
qrText: 'hello world'
}
},
components: {
Qrcode
}
}
</script>
-
value: the string to generate QR Code -
cls: the classname of wrapper,''by default -
size: qrcode's size,100*100by default -
level: qrcode's level,Lby default, value can be one ofL, Q, M, H, -
background: the background color,#fffby default -
foreground: the foreground color,#000by default -
mime: the mime type of image,image/pngby default -
padding: the padding between qrcode and wrapper,0by default -
type: the output type can be eithercanvasorimage