Notification.vue 1002 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div class="notification" :class="[type, isFixed ? 'is-fixed' : '']" v-if="show">
  3. <button class="delete" v-if="isDeletable" @click="close"></button>
  4. {{ message }}
  5. </div>
  6. </template>
  7. <script>
  8. export default {
  9. name: 'Notification',
  10. data() {
  11. return {
  12. show: true
  13. }
  14. },
  15. props: {
  16. type: {
  17. type: String,
  18. default: 'is-primary'
  19. },
  20. message: {
  21. type: String,
  22. default: '',
  23. },
  24. isDeletable: {
  25. type: Boolean,
  26. default: true,
  27. },
  28. isFixed: {
  29. type: Boolean,
  30. default: false
  31. }
  32. },
  33. methods: {
  34. close (event) {
  35. if (event) {
  36. this.show = false
  37. }
  38. }
  39. }
  40. }
  41. </script>