微信小程序二维码生成

微信小程序生成各种类型的二维码

二维码分享设计

在这里插入图片描述

微信接口

1、getQRCode 获取小程序码

该接口用于获取小程序码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制,详见获取小程序码

POST
https://api.weixin.qq.com/wxa/getwxacode?access_token=ACCESS_TOKEN

2、getUnlimitedQRCode 获取不限制的小程序码

该接口用于获取小程序码,适用于需要的码数量极多的业务场景。通过该接口生成的小程序码,永久有效,数量暂无限制

POST
https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=ACCESS_TOKEN

3、createQRCode 获取小程序二维码

获取小程序二维码,适用于需要的码数量较少的业务场景。通过该接口生成的小程序码,永久有效,有数量限制,详见获取二维码。

POST
https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=ACCESS_TOKEN

前端

二维码展示

<!-- 底部二维码区域 -->
				<view class="qrcode-section">
					<view class="qrcode-container">
						<image :src="'data:image/png;base64,'+detailInfo.qrCode" class="qrcode-img" mode="widthFix" />
						<text class="qrcode-text">扫描二维码查看钱币详情</text>
					</view>
					<!-- 新增分享按钮  open-type="share"-->
					<u-button class="share-btn" @click="handleShare" open-type="share">
						<u-icon name="share" :color="themeColor" size="44"></u-icon>
						<text class="share-text">分享给朋友</text>
					</u-button>
				</view>

二维码接口调用

// 获取二维码数据
method:
			async getQrCode(auctionId, envVersion) {
   
   
				const res = await request.request('shareQrcode', {
   
   
					auctionId,
					envVersion
				}, 'GET')
				if (res.code === 200 && res.data.length > 0) {
   
   
					// this.detailInfo.qrCode = res.data
					this.$set(this.detailInfo, 'qrCode', res.data)
					// console.log(this.detailInfo.qrCode);
				}
			},

在这里插入图片描述

二维码扫码回调

	async onLoad(options) {
   
   
			// 处理扫码进入的场景
			if (options.scene) {
   
   
				console.l
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

忙碌的菠萝

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值