article.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="center">
  3. <view class="bg">
  4. <image :src="src" mode=""></image>
  5. </view>
  6. <view class="title">
  7. {{ title }}
  8. </view>
  9. <view class="main flex">
  10. <view class="">{{ author }}</view>
  11. <view class="" style="color: #d8d9da;"><span>{{time}}</span>{{ visit }}</view>
  12. </view>
  13. <view v-html="synopsis" class="content">
  14. {{ synopsis }}
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { details } from '@/api/product.js'
  20. export default {
  21. data(){
  22. return{
  23. src: '',
  24. title: '',
  25. synopsis:'',
  26. time:'',
  27. author:'',
  28. visit:''
  29. }
  30. },
  31. onLoad(option) {
  32. this.loadData(option.id);
  33. },
  34. methods: {
  35. async loadData(id){
  36. let obj = this;
  37. details({},id).then(e =>{
  38. console.log(e);
  39. obj.src = e.data.image_input[0];
  40. obj.title = e.data.title;
  41. obj.synopsis = e.data.content
  42. obj.time = e.data.add_time;
  43. obj.author = e.data.author;
  44. obj.visit = e.data.visit;
  45. })
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss">
  51. .center{
  52. height: 100%;
  53. }
  54. .bg{
  55. width: 100%;
  56. height: 474rpx;
  57. image{
  58. width: 100%;
  59. height: 100%;
  60. }
  61. }
  62. .main {
  63. margin: 20rpx 50rpx;
  64. font-size: 24rpx;
  65. color: #000;
  66. span {
  67. display: inline-block;
  68. padding-right: 20rpx;
  69. }
  70. }
  71. .title{
  72. width: 90%;
  73. margin: 20rpx auto 0;
  74. font-size: 40rpx;
  75. font-weight: 500;
  76. color: #171313;
  77. text-overflow: -o-ellipsis-lastline;
  78. overflow: hidden;
  79. display: -webkit-box;
  80. -webkit-line-clamp: 2;
  81. -webkit-box-orient: vertical;
  82. }
  83. .time {
  84. width: 90%;
  85. margin: 0 auto;
  86. margin-top: 16rpx;
  87. font-size: 24rpx;
  88. font-weight: 500;
  89. color: #656b6c;
  90. }
  91. .content{
  92. width: 90%;
  93. margin:0 auto;
  94. margin-top: 20rpx;
  95. font-size: 32rpx;
  96. font-weight: 500;
  97. color:#777777;
  98. }
  99. /deep/ .content{
  100. img{
  101. width: 100%;
  102. height: 100%;
  103. }
  104. }
  105. </style>