PWA使用Vuejs在iOS上安装promt
我有一个与VUEJS的PWA我需要帮助使这个代码在iPhone上工作。在安卓系统上,它工作得非常完美。如果用户尚未安装应用程序,则会显示该按钮,但如果应用程序已安装,则该按钮将消失。IOS没有提示,但我想添加一个按钮,当单击该按钮时,它将引导用户安装pwaPWA使用Vuejs在iOS上安装promt,ios,vue.js,vuetify.js,progressive-web-apps,Ios,Vue.js,Vuetify.js,Progressive Web Apps,我有一个与VUEJS的PWA我需要帮助使这个代码在iPhone上工作。在安卓系统上,它工作得非常完美。如果用户尚未安装应用程序,则会显示该按钮,但如果应用程序已安装,则该按钮将消失。IOS没有提示,但我想添加一个按钮,当单击该按钮时,它将引导用户安装pwa data() { return { installBtn: 'block', installer: undefined, }, 我认为iOS Safari目前不支持web应用安
data() {
return {
installBtn: 'block',
installer: undefined,
},
我认为iOS Safari目前不支持web应用安装横幅。请参见这是否回答了您的问题?
created(){
const self = this;
let installPrompt;
window.addEventListener("beforeinstallprompt", e => {
e.preventDefault();
installPrompt = e;
this.installBtn = "block";
});
this.installer = () => {
this.installBtn = "none";
installPrompt.prompt();
installPrompt.userChoice.then(result => {
if(result.outcome === "accepted") {
console.log("User Accepted");
} else {
console.log("User denied");
}
installPrompt = null;
});
};
},