article.vue 942 Bytes
<template>
  <Article :on-fetch="onFetch"></Article>
</template>

<script>
import Article from './components/article/article';
import {createNamespacedHelpers} from 'vuex';
const {mapState, mapActions, mapMutations} = createNamespacedHelpers('article');

export default {
  name: 'ArticlePage',
  data() {
    return {
      inx: 0,
    };
  },
  created() {
    console.log('created')
  },
  methods: {
    onFetch() {
      if (!this.allList) {
        this.allList = [];
      }
      const items = Array.from({length: 5}).map((v, i) => {
        return {
          name: 'chenfeng' + (i + 5 * this.inx),
          id: (i + 5 * this.inx),
          inx: (i + 5 * this.inx)
        }
      })

      this.inx++;

      this.allList = this.allList.concat(items);
      return Promise.resolve(items);
    },
  },
  components: {
    Article
  }
};
</script>

<style lang="scss" scoped>
.article-page {
  background-color: #f0f0f0;
}
</style>