scroll-view.vue 1011 Bytes
<template>
  <div class="list-wrapper">
    <Scroll ref="scroll" :options="options" @pulling-up="reachBottom" @pulling-down="pullRefresh" :data="data">
      <slot></slot>
    </Scroll>
  </div>
</template>

<script>

import {Scroll} from 'cube-ui';

export default {
  name: 'yoho-scroll-view',
  props: {
    options: {
      type: Object,
      default() {
        return {};
      }
    },
    pullRefresh: {
      type: Function,
      default() {
        return {};
      }
    },
    reachBottom: {
      type: Function,
      default() {
        return {};
      }
    },
    data: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  methods: {
    forceUpdate() {
      this.$refs.scroll.forceUpdate();
    },
    scrollTo(x, y) {
      this.$refs.scroll.scrollTo(x, y, 1000);
    }
  },
  components: {
    Scroll
  }
};

</script>

<style lang="scss" scoped>
.list-wrapper {
  position: relative;
  height: 100%;
  overflow: hidden;
  background-color: #f0f0f0;
}
</style>