getShareTemplates
相关内容:
开发者通过 getShareTemplates
获取保存在星汉平台的所有分享素材,对应于当前小程序/小游戏的分享素材会一次性全部返回。
调用方法
开发者需传入当前小程序/小游戏版本号。
import XH_MINIPRO_SDK from './utils/xh_minipro_sdk_1.5.0.min.js'
XH_MINIPRO_SDK.getShareTemplates({
version: '1.0.0' //传入当前应用版本号,返回素材
}).then(res=>{
console.log(res)
}).catch((error)=>{
console.log(error)
})
返回值样例
{
"scene_1":[{
"channel_code": "channelA", //渠道码
"title":"分享标题",
"image":"分享图片地址",
"path":"pages/index/index", //跳转小程序路径
"scene":"scene_1", //使用的场景
}],
"scene_2":[{
"channel_code": "channelB",
"title":"分享标题",
"image":"分享图片地址",
"path":"pages/index/index",
"scene":"scene_2",
}]
}
返回值说明
字段 | 字段类型 | 字段说明 |
---|---|---|
channel_code | string | 星汉平台渠道码 |
title | string | 分享卡片标题 |
image | string | 分享卡片图片的url |
path | string | 分享卡片的跳转路径 |
scene | string | 场景值 |