<template>
  <div class="exh-layout">
    <slide :items="items" class="slide-layout" :extend="3" :focus="focus" @slidechange="changeHandle">
      <div slot="item"
        slot-scope="{data, index}"
        class="item"
        @click="clickHandle(index)">
        {{data}}
      </div>
    </slide>

    <div class="ext-name">
      <h3>{{title}}</h3>
    </div>
  </div>
</template>

<script>
import slide from '@/components/slide'

export default {
  name: 'collection',
  data () {
    return {
      items: ['展馆名称1', '展馆名称2', '展馆名称3'],
      focus: 0,
      title: ''
    }
  },
  methods: {
    clickHandle (index) {
      if (this.focus === index) {
        console.log(this.title)
      } else {
        this.focus = index
      }
    },
    changeHandle (item) {
      this.title = item
    }
  },
  components: {slide}
}
</script>

<style scoped>
.exh-layout {
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.slide-layout {
  margin-top: 10%;
  flex: 0 0 auto;
}

.ext-name {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ext-name h3 {
  font-size: 21px;
  font-weight: 300;
  color: #B48A4E
}

.item {
  background-color: #fff;
  height: 100%;
  width: 100%;
  border-radius: 8px;
}

</style>

<style>
.exh-layout .slide-layout {
  width: 72% !important;
  height: 68.4% !important;
  overflow: initial !important;
  margin-left:auto;
  margin-right: auto;
}

.exh-layout .slide-layout .slide-item {
  padding: 14px;
}

.exh-layout .slide-layout .slide-item.active {
  padding: 0;
}

.exh-layout .slide-layout .animation .slide-item {
  transition: all .3s linear;
}
</style>
