目录qrcodejs2Vue-qrqrcodejs2 下载qrcodejs2 cnpm i -S qrcodejs2 使用 <template> <span
下载qrcodejs2
cnpm i -S qrcodejs2
使用
<template>
<span ref="qrCodeUrl"></span>
</template>
<script>
import QRCode from "qrcodejs2";
export default {
data() {
return {};
},
mounted() {
this.creatQrCode();
},
methods: {
creatQrCode() {
let a = new QRCode(this.$refs.qrCodeUrl, {
text: "hello 大家好", // 需要转换为二维码的内容
width: 100,
height: 100,
colorDark: "black", //#000000为黑色
colorLight: "white",
});
console.log("二维码:", a);
},
},
};
</script>
可在二维码中心添加图片
下载:
cnpm i -S vue-qr
使用:
实现效果
代码示例
<template>
<vue-qr
:loGoSrc="imageUrl"
text="https://blog.csdn.net/qq_40323256/"
:size="150"
:margin="0"
colorDark="black"
colorLight="white"
></vue-qr>
</template>
<script>
import vueQr from "vue-qr";
export default {
components: {
vueQr,
},
data() {
return {
imageUrl: require("@/assets/logo.png"), //欲嵌入至二维码中心的 LOGO 地址
};
},
};
</script>
以上就是vue生成二维码QR Code的实现示例详情的详细内容,更多关于vue生成二维码QR Code的资料请关注编程网其它相关文章!
--结束END--
本文标题: vue生成二维码QR Code的简单实现方法示例
本文链接: https://www.lsjlt.com/news/147663.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-12
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0