Advertisement
Guest User

Untitled

a guest
Oct 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. <template>
  2. <modal
  3. :id="modalName"
  4. :name="modalName"
  5. style="z-index: 1"
  6. draggable
  7. resizable
  8. :clickToClose="false"
  9. @opened="opened"
  10. @mousedown="refreshView"
  11. @closed="closed"
  12. >
  13. <v-container fill-height>
  14. <v-layout row wrap>
  15. <v-flex xs12>
  16. <v-layout justify-space-between>
  17. <span class="font-weight-thin title">{{ title }}</span>
  18. <v-spacer></v-spacer>
  19. <button @click="$modal.hide(modalName)">
  20. </button>
  21. </v-layout>
  22. </v-flex>
  23. <v-flex xs12>
  24. <slot></slot>
  25. </v-flex>
  26. <v-flex xs12>
  27. <v-layout justify-end align-end fill-height>
  28. <v-btn color="success" @click="$emit('saved')">Zapisz</v-btn>
  29. <v-btn color="error" @click="$modal.hide(modalName)">Anuluj</v-btn>
  30. </v-layout>
  31. </v-flex>
  32. </v-layout>
  33. </v-container>
  34. </modal>
  35. </template>
  36.  
  37. <script>
  38. export default {
  39. props: {
  40. modalName: {
  41. required: true
  42. },
  43. title: {
  44. required: true
  45. }
  46. },
  47. computed: {
  48. modals() {
  49. return this.$store.getters.getModalsList
  50. }
  51. },
  52. methods: {
  53. opened() {
  54. this.$el.querySelector('.v--modal-box').addEventListener('mousedown', this.refreshView);
  55. this.refreshView();
  56. this.$emit('opened')
  57. },
  58. closed() {
  59. //this.$el.querySelector('.v--modal-box').removeEventListener('mousedown', this.refreshView, false);
  60. this.$emit("closed")
  61. },
  62. refreshView() {
  63. for(let modal of this.modals) {
  64. if(document.getElementById(modal)) {
  65. if(modal == this.$el.id) {
  66. document.getElementById(modal).style.zIndex = 2;
  67. }
  68. else {
  69. document.getElementById(modal).style.zIndex = 1;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement