- Installa APP: Messaggio in CIMA
- in sistemazione: select compare la scelta di prima.
This commit is contained in:
0
src/components/CCheckAppRunning/CCheckAppRunning.scss
Executable file
0
src/components/CCheckAppRunning/CCheckAppRunning.scss
Executable file
54
src/components/CCheckAppRunning/CCheckAppRunning.ts
Executable file
54
src/components/CCheckAppRunning/CCheckAppRunning.ts
Executable file
@@ -0,0 +1,54 @@
|
||||
import { defineComponent, ref, computed, PropType, toRef } from 'vue'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { costanti, IMainCard } from '@store/Modules/costanti'
|
||||
import { CBigBtn } from '@/components/CBigBtn'
|
||||
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CCheckAppRunning',
|
||||
components: { CBigBtn },
|
||||
props: {},
|
||||
setup(props, { emit }) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
const $router = useRouter()
|
||||
const globalStore = useGlobalStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
const deferredPrompt = ref(<any>null)
|
||||
|
||||
const isAppRunning = computed(() => globalStore.isAppRunning )
|
||||
|
||||
const finishLoading = computed(() => globalStore.finishLoading)
|
||||
|
||||
function initprompt() {
|
||||
window.addEventListener('beforeinstallprompt', (event) => {
|
||||
event.preventDefault()
|
||||
console.log('beforeinstallprompt !')
|
||||
// Stash the event so it can be triggered later.
|
||||
deferredPrompt.value = event
|
||||
})
|
||||
}
|
||||
|
||||
function installApp() {
|
||||
if (deferredPrompt.value)
|
||||
deferredPrompt.value.prompt()
|
||||
}
|
||||
|
||||
initprompt()
|
||||
|
||||
return {
|
||||
userStore,
|
||||
tools,
|
||||
costanti,
|
||||
finishLoading,
|
||||
deferredPrompt,
|
||||
installApp,
|
||||
isAppRunning,
|
||||
}
|
||||
}
|
||||
})
|
||||
31
src/components/CCheckAppRunning/CCheckAppRunning.vue
Executable file
31
src/components/CCheckAppRunning/CCheckAppRunning.vue
Executable file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div v-if="finishLoading && !isAppRunning && deferredPrompt" class="row justify-center">
|
||||
|
||||
<q-btn
|
||||
glossy
|
||||
size="xl"
|
||||
label="Installa App"
|
||||
@click="installApp"
|
||||
icon="fas fa-mobile-alt"
|
||||
color="white"
|
||||
text-color="green"
|
||||
/>
|
||||
</div>
|
||||
<!--<div class="row justify-center">
|
||||
<CBigBtn
|
||||
label="Info" to="" @click="showInfo = true" icon="fas fa-info" color="primary"
|
||||
:numcol="3"
|
||||
>
|
||||
</CBigBtn>
|
||||
</div>
|
||||
<div v-if="showInfo">
|
||||
|
||||
</div>-->
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CCheckAppRunning.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CCheckAppRunning.scss';
|
||||
</style>
|
||||
1
src/components/CCheckAppRunning/index.ts
Executable file
1
src/components/CCheckAppRunning/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CCheckAppRunning} from './CCheckAppRunning.vue'
|
||||
Reference in New Issue
Block a user