说明:

  1.开发使用的UI是mintUI,

要求:

1.获取6到13之间的数据:items.slice(6,13)

<mt-cell v-for="(item,index) in items.slice(6,13)" :title="item.title" :key='index'>
    <a :href="item.url" :title="item.title" class="list-url">
         <img :src="item.src" :alt="item.title" class="list-img"/>
    </a>
</mt-cell>

2.获取小于0到6之间的数据:(两种)

  a:items.slice(0,6)

<mt-cell v-for="(item,index) in items.slice(0,6)" :title="item.title" :key='index'>
       <a :href="item.url" :title="item.title" class="list-url">
           <img :src="item.src" :alt="item.title" class="list-img"/>
       </a>
</mt-cell>

  b:v-if="index < 6"

<mt-cell v-for="(item,index) in items" v-if="index < 6" :title="item.title" :key='index'>
       <a :href="item.url" :title="item.title" class="list-url">
           <img :src="item.src" :alt="item.title" class="list-img"/>
       </a>
</mt-cell>

3.获取最后6条数据:items.slice(items.length-6,items.length)

<mt-cell v-for="(item,index) in items.slice(items.length-6,items.length)" :title="item.title" :key='index'>
       <a :href="item.url" :title="item.title" class="list-url">
           <img :src="item.src" :alt="item.title" class="list-img"/>
       </a>
</mt-cell>

 

相关文章:

  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-08-31
相关资源
相似解决方案