0

i'm trying to render a list of studends

  <div v-for="(item , index) in students" nrow='index' :key="item.name" class="row textsh">
                    <div class="presente-assente nascosto">
                      <label onclick="confirm(this,'ssj1')" class="textsh prvb" for=""><i class="fas fa-check"></i></label>
                      <label onclick="confirm(this,'ssj2')" class="textsh assvb" for=""><i class="fas fa-times"></i></label>
                    </div>
                    <span  class="numbstudent">{{index+1}}</span>
                    <span onclick="sel_row(this)" class="namestudent">{{item.name}}</span>      
                  </div> 

is there a way to say that the attribute "nrow" should be the current index in the for?

1 Answer 1

1

what about moving the v-for one level higher, like this:

<div v-for="(item , index) in students">
  <div  nrow='index' :key="item.name" class="row textsh">
  <div class="presente-assente nascosto">
    <label onclick="confirm(this,'ssj1')" class="textsh prvb" for=""><i class="fas fa-check"></i></label>
    <label onclick="confirm(this,'ssj2')" class="textsh assvb" for=""><i class="fas fa-times"></i></label>
  </div>
  <span  class="numbstudent">{{index+1}}</span>
  <span onclick="sel_row(this)" class="namestudent">{{item.name}}</span>
  </div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

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.