-1

动态显示来自 url 的值,已经正确显示在表中,但我想用 div 显示。

<vs-table ref="table" multiple v-model="selected" pagination :max-items="itemsPerPage" :data="products">
  <template slot-scope="{data}">
    <vs-tr :data="row" :key="index" v-for="(row, index) in data">   
      <vs-td>               
        <p>{{data[index].name}}</p>                  
      </vs-td>            
    </vs-tr>        
  </template>
</vs-table>

现在检查这个 div

<template slot-scope="{data}">
 <div v-for="(row1, index1) in data" v-bind:key="row1.id">
   {{data[index1].name}}
 </div>
</template>

这个 div 代码不起作用

4

1 回答 1

0

如果您在同一页面上运行这两者,则可能与您:keys使用同一 ID 有关。例如设置带有前缀的键

<div v-for="(row, index) in data" v-bind:key="'div-'+row.id">
   {{data[index].name}}
</div>
于 2020-09-28T05:41:24.583 回答