<template>
  <div>
    <ul>
      <li v-for="(item, index) in data.list" :key="index" :style="getStyle(data.height)">
        <img :src="item.img" alt="">
        <div class="pop" v-if="item.text">
          <div class="text">{{ item.text }}</div>
        </div>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  props: {
    data: { type: Object }
  },
  methods: {
    getStyle(s) {
      return s ? `height:${s}` : 'height:1.31rem'
    }
  }
}
</script>
<style lang="scss" scoped>
img{
  width: 100%;
  height: 100%;
  display: block;
}
ul{
  display: flex;
  flex-wrap: wrap;
  li{
    width: 1.68rem;
    height: 1.31rem;
    position: relative;
    margin-bottom: .04rem;
    margin-right: .04rem;
    &:nth-child(even){
      margin-right: 0;
    }
    .pop{
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      background: rgba(0, 0, 0, 0.29);
      .text{
        position: absolute;
        bottom: .15rem;
        left: .1rem;
        font-size: .14rem;
        line-height: 100%;
        color: #FFFFFF;
      }
    }
  }
}
</style>
