D
D
Dzamba112018-06-03 22:46:51
Data transfer
Dzamba11, 2018-06-03 22:46:51

How to pass data to modal window?

In general I have 2 or more data arrays. They are not related to each other. They are rendered by v-forom as a list below each other, passing data to the component. And so it is necessary for me that at a clique there was a modal window with the filled data which I can edit. Accordingly, the configuration of the modal differs depending on the array with data. How to do it all right?
Of course, it begs to shove the modal inside the iterable component. But these components can be many. And not ice, probably in terms of performance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Kulakov, 2018-06-03
@kulakoff Vue.js

If we talk about some primitive example, then you can do this:

<template>
<div>
  <div v-for="item in items" @click="currentItem=item; show=true"></div>
  <modal v-if="show" @close="show=false" :data="currentItem">
</div>
</template>

I
Ilya, 2018-06-03
@ilyapashkov02

On a click, you can emit a modal call, and pass the dates as the second argument, which will be passed to the modal window

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question