插件导入地址:
https://ext.dcloud.net.cn/plugin?id=1287#detail
<template>
<view>
<u-qrcode ref="qrcode" canvas-id="qrcode" :value="link" :size="size"></u-qrcode>
<button @click="saveQrcode">保存二维码</button>
</view>
</template>
<script>
export default {
data() {
return {
link: 'https://www.baidu.com/', //二维码内容
size: 150 //二维码大小
}
},
methods: {
// 保存二维码
saveQrcode() {
this.$refs.qrcode.save({
success: res => {
console.log(res)
}
})
}
}
}
</script>
文章评论