1

I have a data where I am using loop. Admin will see a pop up if s/he clicks on the user section. I have following code:

In user list page

<template>
   <header class="headings">
    <div class="headings_title">
        <h3 class="text-center"> User List</h3>
        <div class="text-center" v-for="user in users" :key="user.id">
          <div class="user-section" @click="showModel">
            <User :user="user"/>
          </div>
       </div>
    </div>
   </header>
</template>

The User component is working and user name, address has been displayed. But if the admin clicks on the particular user s/he has to be able to see other information related to the user s/he clicks. I want to pass user data in the modal also so that I can show other details related to the user. How can I do that?

1 Answer 1

1

It's actually quite simple:

<div class="user-section" @click="showModel(user)">...</div>

(See inline handlers in docs)

Sign up to request clarification or add additional context in comments.

4 Comments

the model is in another page so do I have to pass anything from UserList component and receive anything in UserModal component? Because simply doing this does not work
We don't know how your showModel function looks so it's kind of hard to say. Might be a whole new question. Also: models and modals are not the same - take care which one you use.
I have edited my question. Can you please so and say if I am going right way.
This really was a whole new question, sorry. Look for "How to pass data to bootstrap vue modal". The "Passing the current object of loop on click" is answered. stackoverflow.com/questions/51271337/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.