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