nebula/pages/index.vue
2020-08-02 00:25:44 +08:00

37 lines
736 B
Vue

<template>
<div>
<article-list :articles="articles" @currentChange="currentChangeArticle"></article-list>
</div>
</template>
<script>
import ArticleList from '~/components/archive/list'
import {mapState} from 'vuex';
export default {
name: 'Index',
fetch() {
return this.$store.dispatch('article/fetchList', {page: 1})
},
components: {
ArticleList
},
computed: {
...mapState({
articles: state => state.article.list.data
})
},
methods: {
currentChangeArticle(page) {
this.$store.dispatch('article/fetchList', {page: page})
}
},
mounted() {
this.$store.commit('setActiveMenu', 'index')
}
}
</script>
<style>
</style>