简体   繁体   English

vuejs 列表渲染属性 = 索引?

[英]vuejs list rendering attribute = index?

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?有没有办法说属性“nrow”应该是for中的当前索引?

what about moving the v-for one level higher, like this:将 v- 移高一级怎么样,像这样:

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM