article.vue
942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<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>