With Vuejs, how to use a modal component inside a v-for loop the right way

后端 未结 2 566
无人共我
无人共我 2021-02-09 22:19

In my vue.js app, I need to display a list of items which the user can click.

When clicked, each of these items should then fire a modal, containing additional informati

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-09 22:59

    While the accepted answer is great but the modal component has to be designed only for that specific data and it's not reusable.

    Here is how I created a reusable modal regardless of data and style :

    Modal Component: