index.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <div class="container news-container">
  3. <left></left>
  4. <right v-on:childEvent="listenChild"></right>
  5. </div>
  6. </template>
  7. <script>
  8. import { Left, Right } from '~components/news'
  9. import 'bootstrap/dist/css/bootstrap.min.css'
  10. export default {
  11. layout: 'main',
  12. data () {
  13. return {
  14. pageSize: 10,
  15. nowPage: 1
  16. }
  17. },
  18. fetch ({ store }) {
  19. return Promise.all([
  20. store.dispatch('loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
  21. store.dispatch('loadHotNews')
  22. ])
  23. },
  24. components: {
  25. Left,
  26. Right
  27. },
  28. methods: {
  29. listenChild: function (nPage) {
  30. this.nowPage = nPage
  31. this.$store.dispatch('loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
  32. }
  33. }
  34. }
  35. </script>
  36. <style scoped>
  37. /*.clearfix, .nav-list{
  38. font-size: 14px!important;
  39. }
  40. .footer .item{
  41. margin-top: 20px;
  42. }
  43. .navbar{
  44. height: 36px!important;
  45. min-height: 36px!important;
  46. }*/
  47. div{
  48. display: block;
  49. }
  50. </style>