uniapp支付宝小程序授权

template

<button @getAuthorize="onGetAuthorize" scope="userInfo" open-type="getAuthorize" class="login">授权登录</button>

script

//#ifdef  MP-ALIPAY
console.log('支付宝')
//#endif
onGetAuthorize(res) {
	my.getOpenUserInfo({
		fail: (res) => {},
		success: (res) => {
			let userInfo = JSON.parse(res.response).response // 以下方的报文格式解析两层 response
			console.log(userInfo);
			my.alert({
				content: userInfo
			});
		},
	});
},

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
uniapp中,开发支付宝小程序时可以实现免押金。具体步骤如下: 1. 首先,在支付宝开放平台上创建应用,并复制支付宝小程序AppID。将该AppID粘贴到hbuildx项目的manifest.json文件中的支付宝小程序配置中。\[1\] 2. 接下来,在uniapp中开发支付宝小程序授权用户信息和用户手机号码的功能。与微信小程序的API有所不同,但都需要通过<button>点击事件触发。\[2\] 3. 如果你还没有注册微信小程序,可以在微信公众平台上注册一个小程序,并获取微信小程序AppID。将该AppID复制到项目的manifest.json文件中的微信小程序配置中。\[3\] 通过以上步骤,你可以在uniapp中开发支付宝小程序,并实现免押金的功能。 #### 引用[.reference_title] - *1* *3* [uniapp微信小程序&支付宝小程序的初体验,记录一些初次遇到的大坑小坑~](https://blog.csdn.net/qq_57219457/article/details/123127658)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [uniapp支付宝小程序授权用户信息、授权手机号码](https://blog.csdn.net/weixin_49175501/article/details/126106144)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

阿巴资源站

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

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

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

打赏作者

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

抵扣说明:

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

余额充值