1.安装依赖: 使用 qrcode 库来生成二维码。
npm install qrcode.vue --save
2.在页面使用
:value="link":绑定link变量的值作为二维码的内容。link是你要生成二维码的目标链接。:size="200":设置二维码的大小为 200 像素。这个属性期望接收一个数字,而你通过绑定200来传递。background-color="#ffffff":设置二维码的背景颜色为白色。foreground-color="#000000":设置二维码的前景颜色(即二维码的图案)为黑色。
<template>
<qrcode-vue
:value="link"
:size="200"
background-color="#ffffff"
foreground-color="#000000"
></qrcode-vue>
</template>
<script setup>
import { ref } from "vue";
import QrcodeVue from "qrcode.vue";
const link = ref("https://github.com/jin-yufeng/Parser");
</script>
606

被折叠的 条评论
为什么被折叠?



