button组件平台客服能力

更新时间 2024-07-24 02:58:49
收藏
我的收藏
基础库 2.89.0 开始支持本能力。支持小程序拉起平台能力,需要将 button 组件 open-type 的值设置为 platformIm。​
小程序一级类目需要为餐饮、酒店旅游、生活服务。请至抖音开放平台 -> 控制台 -> 设置 -> 基础设置 -> 小程序服务类目查看。​
button 组件常规属性请参考 button 按钮。​

属性说明​

属性名​
类型​
默认值​
必填​
说明​
最低支持版本​
open-type
string
用于调用开放能力,此场景下需要设置为 "platformIm"
2.89.0
data-order-id​
string​
否​
订单的 id,仅支持交易2.0订单,可参考预下单接口
2.89.0​
data-platform-im-type​
string​
是​
type 的合法值
2.89.0​
bindplatformim​
EventHandle​
否​
监听跳转的成功回调​
2.89.0​
binderror​
EventHandle​
否​
监听跳转的失败回调​
2.89.0​

type 的合法值​

说明
最低支持版本
group_buy
小程序一级类目为餐饮、酒店旅游、生活服务​
2.89.0​

binderror 事件对象的 detail​

object 类型,属性如下:​
属性名
类型
说明
最低支持版本
errMsg​
string​
错误描述​
2.89.0​
errNo​
number​
错误码​
2.89.0​

错误说明​

errNo
errMsg
说明
最低支持版本
20000​
invalid params %s, code=%s​
开发者参数错误​
2.89.0​
10401​
host cannot open schema, schema = %s​
打开schema失败​
2.89.0​
10301​
feature is not supported in app​
宿主未实现​
2.89.0​
10401​
internal error, code=%s, msg=%s​
内部错误​
2.89.0​

扫码体验​

代码示例​

html
复制
<button
open-type="platformIm"
bindplatformim="onSuccess"
binderror="onError"
data-platform-im-type="{{platformImType}}"
>
跳转平台客服
</button>
js
复制
Page({
data: {
platformImType: "group_buy",
},
onSuccess(e) {
console.log("跳转平台客服成功", e.detail);
},
onError(e) {
console.log("拉起平台客服失败", e.detail);
},
});

Bug & Tip​

无​