2 回答

TA貢獻1836條經(jīng)驗 獲得超5個贊
您必須將您創(chuàng)建的styleSet傳遞給renderWebChat。您的 styleSet 已創(chuàng)建,但未在任何地方使用。
檢查以下示例:
const styleOptions = {
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)'
};
window.WebChat.renderWebChat(
{
directLine: window.WebChat.createDirectLine({
secret: 'YOUR_BOT_SECRET'
}),
// Passing 'styleOptions' when rendering Web Chat
styleOptions
},
document.getElementById('webchat')
);

TA貢獻1829條經(jīng)驗 獲得超13個贊
您需要將styleSetOptions對象分配給方法的styleOptions屬性,rederWebchat即
const styleSetOptions= window.WebChat.createStyleSet({
bubbleBackground: 'rgba(0, 0, 255, .1)',
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)'
});
window.WebChat.renderWebChat(
{
directLine: Object.assign(
{},
d1,
{
postActivity: activity => {
var newActivity = Object.assign({}, activity, { channelData: {
"siteDomain": siteDomain } });
return d1.postActivity(newActivity);
}
}),
styleOptions: styleSetOptions
},
document.getElementById('webchat')
);
添加回答
舉報