31 lines
618 B
Vue
31 lines
618 B
Vue
|
<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>
|