Left.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. border-radius: 5px;
  63. }
  64. .hot-news h4 span{
  65. background: #feb900;
  66. width: 30px;
  67. height: 40px;
  68. display: inline-block;
  69. position: relative;
  70. text-align: right;
  71. color: #fff;
  72. margin-right: 40px;
  73. font-size: 12px;
  74. line-height: 40px;
  75. float: left;
  76. border-top-left-radius: 5px;
  77. }
  78. .hot-news h4 span:before{
  79. content: '';
  80. position: absolute;
  81. right: -20px;
  82. top: 0;
  83. width: 0;
  84. height: 0;
  85. border-width: 20px 0 20px 20px;
  86. border-style: solid;
  87. border-color: transparent transparent transparent #feb900;
  88. }
  89. .hot-news ol{
  90. padding-top: 0px;
  91. padding-right: 15px;
  92. padding-bottom: 0px;
  93. padding-left: 15px;
  94. }
  95. .hot-news ol li{
  96. border-bottom: #e8e8e8 1px dotted;
  97. }
  98. .hot-news li h5 {
  99. margin-top: 20px;
  100. margin-bottom: 0;
  101. padding: 5px 0;
  102. width: 100%;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. white-space: nowrap;
  106. font-size: 16px;
  107. color: #666666;
  108. line-height: 20px;
  109. font-weight: 600;
  110. }
  111. .hot-news li h5 a {
  112. font-weight: normal;
  113. color: #323232;
  114. }
  115. .hot-news li h5 a:hover{
  116. color: #5078cb;
  117. text-decoration: underline !important;
  118. }
  119. .hot-time{
  120. line-height: 30px;
  121. }
  122. .hot-time span{
  123. font-size: 14px;
  124. color: #999;
  125. }
  126. li{
  127. display: list-item;
  128. text-align: -webkit-match-parent;
  129. }
  130. .list-unstyled{
  131. list-style: none;
  132. }
  133. .hot-news li p{
  134. font-size: 12px;
  135. line-height: 20px;
  136. height: 40px;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. }
  140. .fa {
  141. margin-right: 5px;
  142. }
  143. </style>