首页 > 其他 > 详细

vue中生成二维码

时间:2019-03-06 15:53:34      阅读:239      评论:0      收藏:0      [点我收藏+]
<template>
  <div id="qrcode" ></div>
</template>
<script>
import QRCode from qrcodejs2
export default {
  name: "n-qr",
   props: {
    value: {
      type: String
    },
    options:{
      type:Object,
      default:function() {
        return {
        width: 100,
        height: 100,
        };
      }
    }
  },
   watch: {
    value(v){
      this.qrcode.makeCode(v);
    },
   },
  mounted(){
      this.qrcode = new QRCode("qrcode", this.options);
      this.qrcode.makeCode(this.value);
  }
}
</script>

使用:

 <nqr v-model="qrUrl" :options="options" class="qrcode"></nqr>
import nqr from "./nQr.vue";
export default {
  components: {
    nqr
  },
  data() {
    return {
      qrUrl: "",
      options: {
        width: 200,
        height: 200
      },
      createTime: ""
    };
  },

 

vue中生成二维码

原文:https://www.cnblogs.com/huanhuan55/p/10483374.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!