【发布时间】:2021-02-02 00:08:19
【问题描述】:
我想通过 chrome/firefox 使用按钮 (显示 pwa 安装提示)使我的 vue 应用程序可安装
<button @click="install">install</button>
var deferredPrompt
methods: {
install() {
deferredPrompt.prompt()
deferredPrompt.userChoice.then((choiceResult) => {
if (choiceResult.outcome === 'accepted') {
console.log('User accepted the A2HS prompt')
} else {
console.log('User dismissed the A2HS prompt')
}
deferredPrompt = null
})
}
}
一旦我构建了应用程序及其在线,我单击按钮并在控制台上得到 deferredPrompt null。 我缺少什么?
【问题讨论】:
标签: vue.js vuejs2 progressive-web-apps