Detail.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="col-md-9">
  3. <div class="news-detail" v-bind="item">
  4. <h1 >{{item.title}}</h1>
  5. <div class="hot-time">
  6. <span class="text-num">时间:<span >{{item.created | date}}</span></span>
  7. <span class="pull-right text-num" style="font-size: 12px;"><i class="fa fa-eye" style="margin-left: 15px;"></i>{{item.viewCount}}</span>
  8. </div>
  9. <div class="news-detail-content" v-html=item.content>
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: 'Detail',
  17. computed: {
  18. new () {
  19. return this.$store.state.newsData.detailNews.detailNews
  20. },
  21. item () {
  22. return this.new.data
  23. }
  24. },
  25. filters: {
  26. date: function (input) {
  27. const d = new Date(input)
  28. const year = d.getFullYear()
  29. const monthTemp = d.getMonth() + 1
  30. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  31. const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours() + ' '
  32. const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
  33. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  34. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
  35. }
  36. }
  37. }
  38. </script>
  39. <style scoped>
  40. .col-md-9{
  41. padding-left: 0;
  42. float: right;
  43. margin-top: 10px;
  44. }
  45. @media (min-width: 992px) {
  46. .col-md-9 {
  47. width: 75%;
  48. }
  49. }
  50. .news-detail {
  51. width: 100%;
  52. margin: 0 auto;
  53. }
  54. .news-detail h1 {
  55. font-size: 24px;
  56. line-height: 40px;
  57. margin: 0;
  58. }
  59. .news-detail .hot-time {
  60. margin-bottom: 20px;
  61. }
  62. .hot-time span {
  63. font-size: 14px;
  64. color: #999;
  65. }
  66. .news-detail-content {
  67. width: 100%;
  68. margin: 0 auto;
  69. font-size: 14px;
  70. border-top: #e8e8e8 1px solid;
  71. padding-top: 20px;
  72. line-height: 28px;
  73. color: #666;
  74. }
  75. </style>