forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToast.vue
More file actions
55 lines (49 loc) · 1.32 KB
/
Toast.vue
File metadata and controls
55 lines (49 loc) · 1.32 KB
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
<template>
<v-snackbar
v-model="notificationActive"
text
:color="notification.type"
:timeout="notification.timeout"
>
<v-icon v-if="notification.type === 'success'" :color="notification.type">
{{ mdiCheck }}
</v-icon>
<v-icon v-if="notification.type === 'info'" :color="notification.type">
{{ mdiInformation }}
</v-icon>
{{ notification.message }}
<template #action="{ attrs }">
<v-btn
v-if="$vuetify.breakpoint.lgAndUp"
:color="notification.type"
text
v-bind="attrs"
@click="disableNotification"
>
<span class="font-weight-bold">Close</span>
</v-btn>
</template>
</v-snackbar>
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import { mdiCheck, mdiInformation } from '@mdi/js'
import { Notification } from '~/store'
@Component
export default class Toast extends Vue {
mdiCheck = mdiCheck
mdiInformation = mdiInformation
get notification(): Notification {
return this.$store.getters.getNotification
}
get notificationActive(): boolean {
return this.$store.getters.getNotification.active
}
set notificationActive(state: boolean) {
this.disableNotification()
}
disableNotification() {
this.$store.dispatch('disableNotification')
}
}
</script>