该组件用于在页面中生成二维码,支持在H5环境下保存二维码图片到本地,界面简洁直观。
import { CQRCode } from '@components/plugins/qrcode';
content
(String,默认值:'http://www.aisim.cn'):二维码内容,通常为URL地址size
(Number,默认值:200):二维码尺寸,单位为像素margin
(Number,默认值:2):二维码边距大小downloadable
(Boolean,默认值:false):是否显示"保存到手机"按钮组件没有对外暴露的实例方法
<template>
<view class="page">
<!-- 简单用法 -->
<CQRCode content="https://www.example.com" />
</view>
</template>
<script>
import { CQRCode } from '@components/plugins/qrcode';
export default {
components: {
CQRCode
}
}
</script>
<template>
<view class="page">
<CQRCode
content="https://www.example.com"
:size="300"
:margin="4"
:downloadable="true"
/>
</view>
</template>
<script>
import { CQRCode } from '@components/plugins/qrcode';
export default {
components: {
CQRCode
}
}
</script>