美文网首页
双层 for 实例

双层 for 实例

作者: 阳光之城alt | 来源:发表于2018-07-03 16:20 被阅读0次
image.png
<template>
    <div class="icons">
       <swiper :options="swiperOption">
            <swiper-slide   v-for="(page,index) of pages" :key="index">
                <div class="icon"
                 v-for="item of page"
                :key="item.id" >
                    <div class="icon-img">
                        <img class="icon-img-content" :src="item.img" alt="item.dest" style="opacity: 1;">
                    </div>
                    <p class="icon-desc">{{item.dest}}</p>
                </div>  
             </swiper-slide>
            </swiper>
    </div>
</template>

<script>
export default {
  name:'homeicons',
  data(){
    return{
         swiperOption:{
              autoplay: false
           },
            iconlist:[
                {
                    id:'0001',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/95/f3dd6c383aeb3b02.png",
                    dest:"景点门票"
                },{
                    id:'0002',
                    img:"http://img1.qunarzz.com/piao/fusion/1804/ff/fdf170ee89594b02.png",
                    dest:"深圳必游"
                }
                ,{
                    id:'0003',
                    img:"http://img1.qunarzz.com/piao/fusion/1804/5a/13ceb38dcf262f02.png",
                    dest:"一日游"
                }
                ,{
                    id:'0004',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/76/eb88861d78fb9902.png" ,
                    dest:"动植物园"
                }
                ,{
                    id:'0005',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/27/dac2bcf9added702.png",
                    dest:"海滨海岛"
                }
                ,{
                    id:'0006',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/b1/528a9e80403b8c02.png",
                    dest:"玩转长隆"
                }   ,{
                    id:'0007',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/76/eb88861d78fb9902.png" ,
                    dest:"动植物园"
                }
                ,{
                    id:'0008',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/27/dac2bcf9added702.png",
                    dest:"海滨海岛"
                }
                ,{
                    id:'0009',
                    img:"http://img1.qunarzz.com/piao/fusion/1803/50/26ffa31b56646402.png",
                    dest:"海洋馆"
                }
                
            ]
   }  
  },
  computed:{
      pages(){
          const pages=[]
          this.iconlist.forEach((item,index) => {
            const page=Math.floor(index/8)
              if(!pages[page]){
                  pages[page]=[]
                  console.log(111)
              }
              pages[page].push(item)
                console.log("计算属性"+page+"==>"+pages[page])
          });
              return pages
      }
  }
}
</script>

<style lang="stylus" scoped>
    @import '~styles/varibles.styl'
    @import '~styles/min.styl'
    .icons>>>  .swiper-container
        height 0
        padding-bottom 50%
</style>

相关文章

  • 双层 for 实例

  • 简述ptfe铁氟龙双层涂料管特性

    一、ptfe铁氟龙双层涂料管简介 1.1ptfe铁氟龙双层涂料管简介 铁氟龙双层涂料管、铁氟龙喷涂管、双层喷涂管、...

  • 双层油罐的类型及特点

    目前国内的双层油罐一般有三种型号的 分别是FF双层罐、SS双层罐、SF双层罐。 FF双层罐:内罐、外罐皆为玻璃钢结...

  • 创建型设计模式

    单列设计模式 场景:当系统中只需要一个实例或者一个全局的访问时候实现方式较多, 出于性能考虑 双层校验索用的更为广...

  • 双层小城

    猛然醒来,发现自己正驾驶汽车疾驰在高速公路上。 隧道里昏黄的灯光,引擎的低声轰鸣,随着方向盘的转动而轻微摇摆的车身...

  • 双层大巴

    我有一辆双层大巴,当我穿过丛林越过玛利亚娜海沟登上珠穆拉马峰的时候,我就乘上了这辆敞篷双层大巴。大巴的颜色是鲜艳的...

  • 双层for循环

    一个是对象+数组,一个是都是数组。

  • 双层蛋糕

    写在前面 也可以称作“假手事件续”或者“我的妹妹是病娇·其贰”吧…orz 【摘要】 诺诺想要与我一同庆祝生日,却因...

  • 双层河道

    文字原创/四季界 图片来源/网络 我自己单独骑单车于一个小县城,或许那是我的儿时生长的家乡。夏日的傍晚,夕阳西坠,...

  • 双层彩虹

    中午做了大锅菜,吃的热火朝天。 一边吃,一边想起农村以前娶媳妇都是在院子里,支上大锅熬大锅菜。 里面白菜,豆腐,丸...

网友评论

      本文标题:双层 for 实例

      本文链接:https://www.haomeiwen.com/subject/ughjuftx.html