I want to make my vue app installable via chrome/firefox using a button (to show a pwa install prompt)
<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
})
}
}
Once i build the app and its online, i click the button and got deferredPrompt null on console. What im missing?
