npm install vue-qr --save
<template> <div> <vue-qr :text="downloadData.url" :margin="10" colorDark="#000" colorLight="#fff" :dotScale="1" :logoSrc="downloadData.icon" :logoScale="0.2" :size="200"></vue-qr> </div> </template> <script> import vueQr from 'vue-qr' export default { components: { vueQr }, data() { return { downloadData: { url: 'https://segmentfault.com/hottest', //須要轉化成二維碼的網址 icon: require('./xxx.jpg') //二維碼中間的圖片,能夠不設置 } } } } </script>
插件基本屬性解釋:vue