gancio-upstream/components/Snackbar.vue

40 lines
781 B
Vue
Raw Normal View History

2020-07-25 21:41:22 +02:00
<template lang='pug'>
v-snackbar(
v-model="active"
:color="color"
:bottom="bottom"
:top="top"
:left="left"
:right="right"
:timeout="timeout")
v-icon.mr-3(color="white") {{icon}}
span {{ message }}
template(v-slot:action="{ }")
v-icon(size="16" @click="active = false") mdi-close-circle
</template>
<script>
export default {
data () {
return {
icon: 'md-alert',
color: 'primary',
2020-07-28 12:24:39 +02:00
bottom: false,
top: true,
2020-07-25 21:41:22 +02:00
left: false,
2020-07-28 12:24:39 +02:00
right: false,
2020-07-25 21:41:22 +02:00
active: false,
timeout: 5000,
message: ''
}
},
created () {
2020-07-28 12:24:39 +02:00
this.$root.$message = snackbar => {
2020-07-25 21:41:22 +02:00
this.active = true
this.message = snackbar.message
this.color = snackbar.color || 'primary'
2020-07-28 12:24:39 +02:00
}
2020-07-25 21:41:22 +02:00
}
}
</script>