index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. export default {
  10. layout: 'main',
  11. data () {
  12. return {
  13. pageSize: 10,
  14. nowPage: 1
  15. }
  16. },
  17. fetch ({ store }) {
  18. return Promise.all([
  19. store.dispatch('loadAllNews', { page: this.nowPage, pageSize: this.pageSize }),
  20. store.dispatch('loadHotNews')
  21. ])
  22. },
  23. components: {
  24. Left,
  25. Right
  26. },
  27. methods: {
  28. listenChild: function (nPage) {
  29. this.nowPage = nPage
  30. this.$store.dispatch('loadAllNews', { page: this.nowPage, pageSize: this.pageSize })
  31. }
  32. }
  33. }
  34. </script>
  35. <style>
  36. *{
  37. -webkit-box-sizing: border-box;
  38. -moz-box-sizing: border-box;
  39. box-sizing: border-box;
  40. }
  41. .footer .item{
  42. margin-top: 20px;
  43. }
  44. .navbar{
  45. height: 36px!important;
  46. min-height: 36px!important;
  47. }
  48. .news-container{
  49. font: 100%/1.2 verdana, "Microsoft YaHei", '宋体', serif;
  50. }
  51. .hot-news a:hover{
  52. text-decoration: underline;
  53. }
  54. .news-content a:hover{
  55. text-decoration: underline;
  56. }
  57. div{
  58. display: block;
  59. }
  60. </style>