我正在尝试使用从页面中的机器人网络聊天控件发送的每条消息注入 channelData。我环顾四周,发现了这个样本(https://cmsdk.com/javascript/how-to-send-custom-channel-data-when-using-web-chat-client -with-bot-framework.html )和我的代码看起来像下面的代码。
问题是这在 Chrome 中有效,但扩展运算符 (...) 在 Edge 或 IE 上无效。是否有适用于所有浏览器的替代语法?
var user = {
id: '@User.Identity.Name',
name: '@User.Identity.Name'
};
var bot = {
id: BotId,
name: 'BotName'
};
var botConnect = new BotChat.DirectLine({
secret: '@ViewData["BotSecret"]',
webSockets: 'true'
});
var v = { ...botConnect };
debugger;
BotChat.App({
botConnection: {
...botConnect,
postActivity: activity => {
activity.channelData = {
StudentId: '@User.Identity.Name'
};
return botConnect.postActivity(activity);
}
},
user: user,
bot: bot,
resize: 'detect'
}, document.getElementById("bot"));