Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <template>
  2. <div>
  3. <div v-for="user in users" :key="user.id">
  4. <project-modal
  5. :show="showModal(user.id)"
  6. @close="toggleModal(user.id)" />
  7.  
  8. <a class="text-sm" href="#" @click.stop="toggleModal(user.id)">Show</a>
  9. </div>
  10. </div>
  11. </template>
  12.  
  13. <script>
  14. import ProjectModal from '../project/ProjectModal.vue'
  15.  
  16. export default {
  17. components: {
  18. 'project-modal': ProjectModal
  19. },
  20.  
  21. data() {
  22. return {
  23. activeModal: 0,
  24. }
  25. },
  26.  
  27. methods: {
  28. showModal: function(id) {
  29. return this.activeModal === id
  30. },
  31.  
  32. toggleModal: function (id) {
  33. if(this.activeModal !== 0) {
  34. this.activeModal = 0
  35. return false
  36. }
  37. this.activeModal = id
  38. }
  39. }
  40. }
  41. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement