关闭行为在 Telegram Web 应用程序中不起作用

问题描述 投票:0回答:1

需要有关 Web App Telegram 的关闭行为的帮助。

查找这些文档https://docs.telegram-mini-apps.com/platform/ opening-behavior

在JS中尝试这个方法,不行。需要来自 DurgerKing Bot 的东西 - 当我尝试关闭 Web 应用程序时,我看到弹出窗口

尝试不同的JS脚本

javascript telegram
1个回答
0
投票

我不知道你用什么来制作应用程序客户端,但我使用的是 Vue js。阅读文档后,我发现了 miniApp.ready() 方法,建议尽早调用。但看看我的客户端加载逻辑:

function setupTelegramApp() {
  postEvent("web_app_setup_swipe_behavior", { allow_vertical_swipe: false });
  postEvent("web_app_set_header_color", { color: "#1D1D1D" });
  postEvent("web_app_set_background_color", { color: "#1D1D1D" });
  postEvent("web_app_setup_closing_behavior", { need_confirmation: false });
  postEvent("web_app_expand");
  postEvent("web_app_setup_back_button", { is_visible: false });
  progressWidth.value = "90%";
}


onMounted(async () => {
  const [miniApp] = initMiniApp(); 
  miniApp.ready()
  ...

  setupTelegramApp();
  ...
})

© www.soinside.com 2019 - 2024. All rights reserved.