Product Details For this modal 1 it will be In my component, I have three popup modals with different content. By clicking on a specific button, I need to open the corresponding popup modal. This is what I'm doing For button 1 - For this modal 1 will be Here is a button click method. Click events for multiple different modal boxes like this. So, how can I use a switch case statement to avoid repeating the modal box code multiple times and just change the inner content component? Any suggestions will be helpful. methods: { onClickProdOpen() { this.isShowPopup1 = true; this.popupOpenDefaultTab = 0; } }
One option is to put the state of each modal in an object. This way, you don't need to add a data attribute to each modal.
If the content inside the modal is similar enough, you can use v-for, using the index as the key in the same way.
https://codepen.io/timfranklin/pen/abWEwLy?editors=1111