[[对象错误]:{消息:“无效地破坏不可迭代的尝试实例”,堆栈:“ TypeError:无效的破坏尝试e.exports上的不可迭代实例(https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:566613)在e.exports处t.unstable_runWithPriority(https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:351563)卢比(https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:339772)在Ps(https://cdn.botframework.com/botframework-webchat/latest/webchat.js:1:339567)“}
(async function () {
const res = await fetch('https://tokenservice/api/DLToken', { method: 'POST' });
const {token} = await res.json();
console.log({token});
window.WebChat.renderWebChat(
{
bot: bot,
directLine: window.WebChat.createDirectLine({token}),
user: user,
speechOptions: speechOptions,
resize: 'detect',
styleOptions: styleOptions
},
document.getElementById('BotChatGoesHere')
);
我在Edge和IE中遇到此错误,在Chrome中正常运行。请提出解决方案,有义务。
IE 11不支持async/await
关键字。我们需要在IE中使用es5捆绑软件。请尝试改用https://cdn.botframework.com/botframework-webchat/latest/webchat-es5.js
。
参考:
Latest WebChat : IE11 Compatibility
Sample - Getting Started with Web Chat CDN with ES5 Polyfills