yzxy-mobile/pages/index/qrcode.vue

31 lines
618 B
Vue
Raw Permalink Normal View History

2024-08-26 17:24:26 +08:00
<template>
<view class="qrcode">
<view :id="ids" ref="qrcode" class="flex_items flex_center"></view>
</view>
</template>
<script>
import QRCode from "qrcodejs2";
export default {
data() {
return {};
},
props:['uri','ids'],
created() {},
mounted() {
this.$nextTick(() => {
this.qrcode();
});
},
methods: {
qrcode() {
let qrcode = new QRCode(this.ids, {
width: 80, // 设置宽度,单位像素
height: 80, // 设置高度,单位像素
text: this.uri, // 设置二维码内容或跳转地址
});
},
},
};
</script>
<style>
</style>