【问题标题】:Method or event which close telegram web app关闭电报网络应用程序的方法或事件
【发布时间】:2022-08-19 02:44:25
【问题描述】:

我使用 React Js 制作电报网络应用程序。 我需要关闭电报网络应用程序并返回聊天的方法。 我发现有方法 close inwindow.Telegram.WebApp.但是当我安慰时它是未定义的。而且这种方法行不通。 甚至 console.log(window) 在电报网络应用程序中也不返回任何内容

    标签: telegram telegram-bot


    【解决方案1】:

    问题出在 TS 中的全局参数中 需要申报

    declare global {
      interface Window {
        Telegram: {
          WebApp: {
            close: () => void;
          }
        };
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-03
      • 2012-10-04
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      相关资源
      最近更新 更多