Detail.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 month = d.getMonth() + 1
  30. const hour = d.getHours()
  31. const minutes = d.getMinutes()
  32. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' ' + hour + ':' + minutes
  33. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
  34. }
  35. }
  36. }
  37. </script>
  38. <style scoped>
  39. .col-md-9{
  40. padding-left: 0;
  41. float: right;
  42. margin-top: 10px;
  43. }
  44. @media (min-width: 992px) {
  45. .col-md-9 {
  46. width: 75%;
  47. }
  48. }
  49. .news-detail {
  50. width: 100%;
  51. margin: 0 auto;
  52. }
  53. .news-detail h1 {
  54. font-size: 24px;
  55. line-height: 40px;
  56. margin: 0;
  57. }
  58. .news-detail .hot-time {
  59. margin-bottom: 20px;
  60. }
  61. .hot-time span {
  62. font-size: 14px;
  63. color: #999;
  64. }
  65. .news-detail-content {
  66. width: 100%;
  67. margin: 0 auto;
  68. font-size: 14px;
  69. border-top: #e8e8e8 1px solid;
  70. padding-top: 20px;
  71. line-height: 28px;
  72. color: #666;
  73. }
  74. </style>