| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <template>
- <div class="container news-container">
- <left></left>
- <right @pageEvent="listenChild"></right>
- </div>
- </template>
- <script>
- import { Left, Right } from '~components/news'
- export default {
- layout: 'main',
- data () {
- return {
- pageSize: 10,
- nowPage: 1
- }
- },
- fetch ({ store }) {
- return Promise.all([
- store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
- store.dispatch('newsData/loadHotNews')
- ])
- },
- components: {
- Left,
- Right
- },
- methods: {
- listenChild: function (nPage) {
- this.nowPage = nPage
- console.log(this.nowPage)
- this.$store.dispatch('newsData/loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
- }
- }
- }
- </script>
- <style scoped>
- body{
- font-size: 14px!important;
- }
- .news-container{
- margin-top: 15px;
- }
- </style>
|