Tawk.to onLoad 未在 JavaScript 网站 (LitElement) 中调用

问题描述

我有一个基于 LitElement 的 JavaScript 网站。我已经集成了 Tawkto 的实时聊天小部件。小部件打开正常。但是我需要预设用户名和电子邮件,这就是为什么我需要调用他们的 documentation 中提到的 onLoad 函数

以下是我放在 index.js 文件中的参考代码

var Tawk_API=Tawk_API||{},Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='https://embed.tawk.to/xxxxxxxxxxxxxxxxxxxx/xxxxxxxx';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);
})();

/* onLoad function is not working */
Tawk_API.onLoad = function () {
  console.log("chat loaded");
  Tawk_API.setAttributes(
    {
      name: "Test Name",email: "email@email.com",hash: "hash value",},function (error) {}
  );
};

谁能告诉我我做错了什么。谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)