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