Snackbar.vue 680 Bytes
<template>
  <v-snackbar
    v-model="show"
    :color="color"
    :timeout="6000"
    top
  >
    {{ text }}
    <v-btn
      dark
      flat
      @click="show = false"
    >
      ปิด
    </v-btn>
  </v-snackbar>
</template>

<script>
export default {
  computed: {
    show: {
      get () {
        return this.$store.getters.getSnackbar.show
      },
      set (value) {
        this.$store.commit('setSnackbar', {
          show: false,
          color: null,
          text: null
        })
      }
    },
    color () {
      return this.$store.getters.getSnackbar.color
    },
    text () {
      return this.$store.getters.getSnackbar.text
    }
  }
}
</script>