Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. methods: {
  2. closeModal: function(){
  3. function closeM(){
  4. $('.modal').css({opacity: 0 , 'visibility':'hidden'});
  5. }
  6. closeM();
  7. },
  8.  
  9. closeOutside: function(){
  10. $(document).mouseup(function (e){
  11. var container1 = $('.modal__box');
  12. if (!container1.is(e.target) &&
  13. container1.has(e.target).length === 0)
  14. {
  15. this.$emit('closeModal',closeM());
  16. }
  17. });
  18. }
  19. }
  20.  
  21. <div class="modal" @click="closeOutside()">
  22. <div class="modal__box z-depth-2 pr">
  23. <div class="modal__header"> {{header}} </div>
  24. <i class="modal__close pa fa fa-times" @click="closeModal() "> </i>
  25. <div class="modal__content">
  26. <slot> </slot>
  27. </div>
  28. </div>
  29. </div>
  30.  
  31. this.$emit('closeModal',closeM());
  32.  
  33. this.$emit('closeModal',this.closeModal());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement