-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
56 lines (49 loc) · 1.31 KB
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script setup lang="ts">
import { loadingController } from '@ionic/vue'
import { installPrompt } from './utils/pwa'
import { appName } from '~/constants'
import { useIndexedDB } from '~/composables/db'
// https://nuxt.com/docs/api/composables/use-head
useHead({
title: appName,
meta: [
{
name: 'description',
content: '好的,今天我们来做菜!',
},
],
})
const indexedDB = useIndexedDB()
onMounted(() => {
installPrompt()
showLoading()
indexedDB.init()
})
async function showLoading() {
const loading = await loadingController.create({
duration: 3000,
spinner: null,
cssClass: 'custom-loading',
message: 'Loading...',
})
await loading.present()
const loadingElement = document.querySelector('.custom-loading .loading-wrapper')
if (loadingElement) {
loadingElement.innerHTML = '<img src="/img/loading_cook.gif" alt="Loading...">'
}
// click to redirect
loadingElement?.addEventListener('click', () => {
// target="_blank" will not work
window.open('https://cook-wiki.vercel.app/', '_blank')
})
}
const themeVars = reactive({ dropdownMenuShadow: 'none' })
</script>
<template>
<van-config-provider :theme-vars="themeVars">
<VitePwaManifest />
<ion-app>
<ion-router-outlet />
</ion-app>
</van-config-provider>
</template>