order.vue 2.21 KB
<template>
  <Layout>
      <Slide ref="slide"
             :data="list"
             :loop="false"
             :autoPlay="false"
             direction="vertical"
             class="slide-container"
             :showDots="false"
             @scroll-end="onChange"
             :speed="1000"
             :threshold="0.05"
             :options="scrollOpts"
      >
        <SlideItem v-for="i in list" :key="i">
          <OrderSlideItem @on-comment-click="onComment"></OrderSlideItem>
        </SlideItem>
      </Slide>

    <CommentActionSheet ref="actionsheet"></CommentActionSheet>
  </Layout>
</template>

<script>

import {Slide} from 'cube-ui';
import OrderSlideItem from './components/order-slide-item';
import CommentActionSheet from '../article/components/detail/comment-action-sheet';

export default {
  name: 'ShowOrderPage',
  components: {
    Slide,
    SlideItem: Slide.Item,
    OrderSlideItem,
    CommentActionSheet
  },
  data() {
    return {
      list: [
        {
          url: 'http://www.didichuxing.com/',
          image: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3978382133,2176310874&fm=27&gp=0.jpg'
        },
        {
          url: 'http://www.didichuxing.com/',
          image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide02.png'
        },
        {
          url: 'http://www.didichuxing.com/',
          image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide02.png'
        },
      ],
      scrollOpts: {
        deceleration: 0.0001,
        listenScroll: true,
        probeType: 3,
        click: true,
        directionLockThreshold: 0,
        stopPropagation: true
      }
    };
  },
  mounted() {
  },
  methods: {
    onChange() {
      this.$nextTick(() => {
        this.list.shift();
        this.list.push({
          url: 'http://www.didichuxing.com/',
          image: '//webapp.didistatic.com/static/webapp/shield/cube-ui-examples-slide03.png'
        });
      });
    },
    clickHandler(e) {
      console.log(e);
    },
    onComment() {
      console.log('ok');
      this.$refs.actionsheet.click();
    }
  }
};
</script>

<style lang="scss" scoped>

.slide-container {
  /deep/ .cube-slide-item {
    width: 100%;
  }
}

</style>