Nhảy tới nội dung

my.setChatSellerProfileId

setChatSellerProfileId

my.setChatSellerProfileId là API dùng để set chat seller profile Id. Nếu set chat seller profile Id thì khi mở chat từ option menu, sẽ mở tới kênh chat với seller đó.

Quét mã để trải nghiệm

Xem code mẫu trên Tini Studio

Demo

Trải nghiệm thử với trình giả lập bên dưới

API Params

Thuộc tínhKiểu dữ liệuBắt buộcMô tả
sellerIdNumberId của nhà bán
successFunctionCallback function khi set chat seller profile Id được thực hiện thành công
failFunctionCallback function khi set chat seller profile Id thất bại, argument sẽ là error message
completeFunctionCallback function khi set chat seller profile Id kết thúc cho dù thành công hay thất bại.

Sample Code

index.txml
<view>
<block-header
title="Usage"
description="my.setChatSellerProfileId" />
<view class="block-content">
<view>
<input style="width:100%" type="text" placeholder="seller id" name="key" value="{{sellerId}}" onInput="sellerIdChange"></input>
</view>
<view>
<button class="button-full" onTap="onTapChange">setChatSellerProfileId</button>
</view>
</view>
</view>
index.js
Page({
data: {
sellerId: ''
},
sellerIdChange(e) {
this.setData({
sellerId: e.detail.value
});
},
onTapChange() {
my.setChatSellerProfileId({
sellerId: this.data.sellerId,
success: (res) => {
my.alert({ content: `Đã set seller id thành công` });
}
});
}
});