feature: pwa
This commit is contained in:
@@ -302,6 +302,49 @@ onNuxtReady(async () => {
|
||||
<v-main>
|
||||
<NuxtPage/>
|
||||
</v-main>
|
||||
|
||||
<div>
|
||||
<div
|
||||
v-if="$pwa?.offlineReady || $pwa?.needRefresh"
|
||||
class="pwa-toast"
|
||||
role="alert"
|
||||
>
|
||||
<div class="message">
|
||||
<span v-if="$pwa.offlineReady">
|
||||
App ready to work offline
|
||||
</span>
|
||||
<span v-else>
|
||||
New content available, click on reload button to update.
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="$pwa.needRefresh"
|
||||
@click="$pwa.updateServiceWorker()"
|
||||
>
|
||||
Reload
|
||||
</button>
|
||||
<button @click="$pwa.cancelPrompt()">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="$pwa?.showInstallPrompt && !$pwa?.offlineReady && !$pwa?.needRefresh"
|
||||
class="pwa-toast"
|
||||
role="alert"
|
||||
>
|
||||
<div class="message">
|
||||
<span>
|
||||
Install PWA
|
||||
</span>
|
||||
</div>
|
||||
<button @click="$pwa.install()">
|
||||
Install
|
||||
</button>
|
||||
<button @click="$pwa.cancelInstall()">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
@@ -316,4 +359,27 @@ onNuxtReady(async () => {
|
||||
background-color: #999;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.pwa-toast {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
margin: 16px;
|
||||
padding: 12px;
|
||||
border: 1px solid #8885;
|
||||
border-radius: 4px;
|
||||
z-index: 1;
|
||||
text-align: left;
|
||||
box-shadow: 3px 4px 5px 0 #8885;
|
||||
}
|
||||
.pwa-toast .message {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.pwa-toast button {
|
||||
border: 1px solid #8885;
|
||||
outline: none;
|
||||
margin-right: 5px;
|
||||
border-radius: 2px;
|
||||
padding: 3px 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user