<template>
  <div class="mclz-card">
    <h5 style="padding: 10px 15px; text-align: left">名厨亮灶</h5>
    <el-carousel :interval="5000" indicator-position="none" type="card" class="carousel_mclz">
      <el-carousel-item v-for="(arr,index) in data" :key="index" class="carousel_mclz">
        <easy-player live muted autoplay :video-url="arr.path" class="carousel_mclz medium" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import { getVideo } from '@/api/home'
import { mapGetters } from 'vuex'
import EasyPlayer from '@easydarwin/easyplayer'

export default {
  name: 'Mclz',
  comments: { EasyPlayer },
  data() {
    return {
      data: []
    }
  },
  computed: {
    ...mapGetters([
      'baseApi'
    ])
  },
  created() {
    this.getPanelGroup()
  },
  methods: {
    getPanelGroup() {
      getVideo().then(res => {
        // const array = []
        // for (let i = 0; i < res.length; i++) {
        //   array.push(res.slice(i, (i + 1)))
        // }
        // this.data = array
        this.data = res
      })
    }
  }
}
</script>

<style scoped>

.el-carousel__item easy-player {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
  .mclz-card{
    background: white;
    /* margin-bottom: 10px; */
    text-align: center;
    height: 460px;
  }
  .mclz-video{
    width: 31%;
    margin: 20px auto;
  }

  .carousel_mclz{
    height: 340px;
  }

</style>
