我正在使用新的webcomponent <pwa-install >Install </pwa-install>使用PWA Builder安装我的PWA应用程序。按钮工作良好,但我唯一的问题是,我不能让它消失,如果应用程序已经安装。
我试图隐藏install按钮,只在激活beforeinstallprompt时显示它,但失败了:
self.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
this.deferredPrompt = e;
$("#installbanner").show();
});我还尝试了appinstalled方法,但效果不佳。
self.addEventListener('appinstalled', (evt) => {
app.logEvent("App is installed");
$("#installbanner").show();
});我还尝试显示了<pwa-install >Install </pwa-install>中包含的所有可用方法,但它只显示了jibrish。
我真的很抱歉打扰大家,可以请您帮忙吗
发布于 2021-07-07 23:53:28
您可以尝试使用媒体显示查询,例如,您可以尝试以下属性之一:
@media all and (display-mode: standalone) {
pwa-install{
display: none;
opacity: 0;
visibility: hidden;
}
}
https://stackoverflow.com/questions/65149576
复制相似问题