order-slide-item.vue 2 KB
<template>
  <div class="order-wrapper">
    <AvatarHeader class="avatar-wrapper"></AvatarHeader>
    <Slide :data="list" :loop="false" :autoPlay="false" class="slide-container" @change="slideChangeHandler">
      <SlideItem v-for="i in list">
        <div class="image-wrapper">
          <img class="image" :src="i" alt="">
        </div>
      </SlideItem>

      <template slot="dots"><i></i></template>
    </Slide>

    <div class="image-preview-footer">
      <span class="image-preview-counter">{{currentPageIndex + 1}}/{{list.length}}</span>
    </div>
  </div>
</template>

<script>

import {Slide} from 'cube-ui';
import AvatarHeader from './avatar-header';

export default {
  name: 'ShowOrderItem',
  components: {
    AvatarHeader,
    Slide,
    SlideItem: Slide.Item
  },
  data() {
    return {
      list: [
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0mpd5uj21hc0tyws2.jpg',
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0ncnnej21hc0zetxo.jpg',
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0mqvu5j21hc0zkgzz.jpg',
        'https://wx1.sinaimg.cn/mw1024/686d7361ly1fpha0m3ufuj21hc0zkqbj.jpg'
      ],

      currentPageIndex: 0

    };
  },
  methods: {
    close() {

    },
    slideChangeHandler(currentPageIndex) {
      this.currentPageIndex = currentPageIndex;
    }
  }
};
</script>

<style lang="scss" scoped>
.order-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  background-image: url('~statics/image/showorder/sd_bg@2x.png');
  background-size: cover;
}

.avatar-wrapper {
  position: absolute;
  width: 100%;
  top: 0;
  z-index: 2;
}

.image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;

  .image {
    width: 100%;
  }
}

.image-preview-footer {
  position: absolute;
  width: 180px;
  height: 60px;
  background: rgba(0, 0, 0, 0.4);
  top: 110px;
  right: -60px;
  border-radius: 30px;
}

.image-preview-counter {
  margin-left: 40px;
  font-size: 26px;
  color: white;
  height: 60px;
  line-height: 60px;
}
</style>