nebula/pages/index.vue

37 lines
736 B
Vue
Raw Normal View History

2020-06-19 17:10:44 +08:00
<template>
<div>
2020-06-22 17:13:42 +08:00
<article-list :articles="articles" @currentChange="currentChangeArticle"></article-list>
2020-06-19 17:10:44 +08:00
</div>
</template>
2020-06-22 17:13:42 +08:00
<script>
import ArticleList from '~/components/archive/list'
2020-08-02 00:25:44 +08:00
import {mapState} from 'vuex';
2020-07-03 11:04:25 +08:00
2020-06-22 17:13:42 +08:00
export default {
name: 'Index',
2020-08-02 00:25:44 +08:00
fetch() {
return this.$store.dispatch('article/fetchList', {page: 1})
2020-06-22 17:13:42 +08:00
},
components: {
ArticleList
},
computed: {
2020-08-02 00:25:44 +08:00
...mapState({
articles: state => state.article.list.data
})
2020-06-22 17:13:42 +08:00
},
methods: {
currentChangeArticle(page) {
this.$store.dispatch('article/fetchList', {page: page})
}
2020-07-03 11:04:25 +08:00
},
mounted() {
this.$store.commit('setActiveMenu', 'index')
2020-06-22 17:13:42 +08:00
}
}
</script>
2020-06-19 17:10:44 +08:00
<style>
</style>