Detail.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div class="col-md-9" style="background: #fff;">
  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. float: right;
  42. padding: 15px 10px;
  43. min-height:1200px;
  44. border-radius:5px;
  45. }
  46. @media (min-width: 992px) {
  47. .col-md-9 {
  48. width: 75%;
  49. }
  50. }
  51. .news-detail {
  52. width: 100%;
  53. margin: 0 auto;
  54. }
  55. .news-detail h1 {
  56. font-size: 24px;
  57. line-height: 40px;
  58. margin: 0;
  59. }
  60. .news-detail .hot-time {
  61. margin-bottom: 20px;
  62. }
  63. .hot-time span {
  64. font-size: 14px;
  65. color: #999;
  66. }
  67. .news-detail-content {
  68. width: 100%;
  69. margin: 0 auto;
  70. font-size: 14px;
  71. border-top: #e8e8e8 1px solid;
  72. padding-top: 20px;
  73. line-height: 28px;
  74. color: #666;
  75. }
  76. </style>