W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
cloud.base.qrcode.create 是小程序二維碼場(chǎng)景 下創(chuàng)建小程序二維碼的接口。
使用該API前,請(qǐng)確認(rèn)你的小程序應(yīng)用已經(jīng)添加了 小程序二維碼 功能
字段名 | 類型 | 必填 | 說明 |
---|---|---|---|
urlParam | String | 是 | 小程序中能訪問到的頁(yè)面路徑,例如:page/component/component-pages/view/view |
queryParam | String | 是 | 小程序的啟動(dòng)參數(shù),打開小程序的query ,在小程序 onLaunch的方法中獲取 |
describe | String | 是 | 二維碼描述 |
appAuthToken | String | 否 | 三方代調(diào)用應(yīng)用訪問令牌,目前僅在云函數(shù)中調(diào)用支持。 |
module.exports = async function (ctx) {
const res = await ctx.cloud.base.qrcode.create({
urlParam: 'pages/index/index',
describe: '我的二維碼描述',
queryParam: 'key=value'
});
return res;
};
支持傳入appAuthToken進(jìn)行三方代調(diào)用
module.exports = async function (ctx) {
const res = await ctx.cloud.base.qrcode.create({
urlParam: 'pages/index/index',
describe: '我的二維碼描述',
queryParam: 'key=value'
}, {
// appAuthToken參數(shù)接收自云函數(shù)調(diào)用處傳入的參數(shù)
appAuthToken: ctx.args.appAuthToken
});
return res;
};
alipay-serverless-sdk 版本&=1.0.0
import cloud from 'alipay-serverless-sdk';
?
const res = await cloud.base.qrcode.create({
urlParam: 'pages/index/index',
describe: '我的二維碼描述',
queryParam: 'key=value'
});
alipay-serverless-sdk 版本<1.0.0
import cloud from 'alipay-serverless-sdk';
?
const res = await cloud.base.qrcode.create('pages/index/index', 'key=value', '我的二維碼描述');
{
"code":"10000",
"msg":"Success",
"qrCodeUrl":"https://mass.alipay.com/wsdk/img?fileid=A*023KQ47KNiYAAAAAAAAAAAAAAQAAAQ&bz=am_afts_openhome&zoom=original"
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: