我必须双击我的支持按钮才能让对讲机出现在初始点击时
private handleSupportClick() {
const ic = (window as any).Intercom;
function l() {
const d = document;
const s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://widget.intercom.io/widget/';
const x = d.getElementsByTagName('script')[0];
(x as any).parentNode.insertBefore(s, x);
}
(window as any).intercomSettings = {
app_id: process.env.REACT_APP_INTERCOM_APP_ID as string,
hide_default_launcher: true
};
(() => {
l();
if (typeof ic === "function") {
ic('reattach_activator');
ic('show', (window as any).intercomSettings);
} else {
const i = (...args: any) => {
(i as any).c(...args)
};
(i as any).q = [];
(i as any).c = (args: any) => {
(i as any).q.push(args)
};
(window as any).Intercom = i;
this.handleSupportClick();
}
})()
}
.
不过,在第一次点击之后,只需单击我的支持按钮即可召唤同一个信使。我已经逐行跟踪调试器中的流程,但我仍然找不到为什么这需要双击。当然,我已经在初始单击后再次调用了函数本身,但这仍然不起作用,并且我收到一条错误消息“在非对象上调用 CreateListFromArrayLike”
非常感谢任何和所有帮助。