Loader.vue 917 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template lang="pug">
  2. modal(name="pos-loader" transition="nice-modal-fade" @before-close="beforeClose")
  3. h2 Cargando
  4. </template>
  5. <script>
  6. import { mapGetters, mapActions } from 'vuex'
  7. export default {
  8. computed: mapGetters({
  9. loaded: 'isLoaded'
  10. }),
  11. watch: {
  12. loaded(completed) {
  13. if (completed) {
  14. this.$modal.hide("pos-loader")
  15. } else {
  16. this.$modal.show("pos-loader")
  17. }
  18. }
  19. },
  20. methods: {
  21. beforeClose(e) {
  22. if (!this.loaded) {
  23. e.stop()
  24. }
  25. },
  26. ...mapActions([
  27. 'clear'
  28. ])
  29. },
  30. mounted() {
  31. this.clear()
  32. this.$modal.show("pos-loader")
  33. }
  34. }
  35. </script>
  36. <style lang="sass">
  37. </style>