Last active
February 5, 2025 00:10
-
-
Save rafaelogic/2b866975b858b182eafaa580313fbdcf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| <div v-for="user in users" :key="user.id"> | |
| <user-profile-modal | |
| :show="showModal(user.id)" | |
| @close="toggleModal(user.id)" /> | |
| <a class="text-sm" href="#" @click.stop="toggleModal(user.id)">Show</a> | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| import UserProfileModal from './UserProfileModal.vue' | |
| export default { | |
| components: { UserProfileModal }, | |
| data() { | |
| return { | |
| activeModal: 0, | |
| } | |
| }, | |
| methods: { | |
| showModal: function(id) { | |
| return this.activeModal === id | |
| }, | |
| toggleModal: function (id) { | |
| if(this.activeModal !== 0) { | |
| this.activeModal = 0 | |
| return false | |
| } | |
| this.activeModal = id | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment