Left.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="hot-news col-md-3">
  3. <h4>
  4. <span>hot</span>热门文章
  5. </h4>
  6. <div>
  7. <ol class="list-unstyled">
  8. <li v-for="item in news_show" v-bind="item">
  9. <h5>
  10. <nuxt-link :to="'/news/'+item.id" :title=item.title
  11. v-text=item.title></nuxt-link>
  12. </h5>
  13. <div class="hot-time">
  14. <span class="text-num">{{item.created | date}}</span>
  15. <span class="pull-right text-num" style="font-size: 12px">
  16. <i class="fa fa-eye" style="margin-left: 15px;"></i>{{item.viewCount}}
  17. </span>
  18. </div>
  19. <p class="text-muted summary" v-text=item.summary></p>
  20. </li>
  21. </ol>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. export default {
  27. computed: {
  28. new () {
  29. return this.$store.state.newsData.hotNews.hotNews
  30. },
  31. news_show () {
  32. return this.new.data
  33. }
  34. },
  35. filters: {
  36. date: function (input) {
  37. const d = new Date(input)
  38. const year = d.getFullYear()
  39. const monthTemp = d.getMonth() + 1
  40. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  41. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  42. return year + '-' + month + '-' + day
  43. }
  44. }
  45. }
  46. </script>
  47. <style>
  48. .hot-news{
  49. background: #fff;
  50. border-radius:5px;
  51. width:260px;
  52. padding: 0;
  53. }
  54. .hot-news h4{
  55. background: #ecf2fd;
  56. width: 100%;
  57. height: 40px;
  58. line-height: 40px;
  59. font-size: 18px!important;
  60. margin: 0;
  61. font-weight: normal;
  62. }
  63. .hot-news h4 span{
  64. background: #feb900;
  65. width: 30px;
  66. height: 40px;
  67. display: inline-block;
  68. position: relative;
  69. text-align: right;
  70. color: #fff;
  71. margin-right: 40px;
  72. font-size: 12px;
  73. line-height: 40px;
  74. float: left;
  75. }
  76. .hot-news h4 span:before{
  77. content: '';
  78. position: absolute;
  79. right: -20px;
  80. top: 0;
  81. width: 0;
  82. height: 0;
  83. border-width: 20px 0 20px 20px;
  84. border-style: solid;
  85. border-color: transparent transparent transparent #feb900;
  86. }
  87. .hot-news ol{
  88. padding-top: 0px;
  89. padding-right: 15px;
  90. padding-bottom: 0px;
  91. padding-left: 15px;
  92. }
  93. .hot-news ol li{
  94. border-bottom: #e8e8e8 1px dotted;
  95. }
  96. .hot-news li h5 {
  97. margin-top: 20px;
  98. margin-bottom: 0;
  99. padding: 5px 0;
  100. width: 100%;
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. white-space: nowrap;
  104. font-size: 16px;
  105. color: #666666;
  106. line-height: 20px;
  107. font-weight: 600;
  108. }
  109. .hot-news li h5 a {
  110. font-weight: normal;
  111. color: #323232;
  112. }
  113. .hot-news li h5 a:hover{
  114. color: #5078cb;
  115. text-decoration: underline !important;
  116. }
  117. .hot-time{
  118. line-height: 30px;
  119. }
  120. .hot-time span{
  121. font-size: 14px;
  122. color: #999;
  123. }
  124. li{
  125. display: list-item;
  126. text-align: -webkit-match-parent;
  127. }
  128. .list-unstyled{
  129. list-style: none;
  130. }
  131. .hot-news li p{
  132. font-size: 12px;
  133. line-height: 20px;
  134. height: 40px;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. }
  138. .fa {
  139. margin-right: 5px;
  140. }
  141. </style>