details.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view class="contents">
  3. <view class="time">
  4. <text>{{ item.createTime }}</text>
  5. <text class="views" v-if="item.views">{{ item.views }} 人看过</text>
  6. </view>
  7. <view class="title">
  8. <text v-if="item.title">【{{ item.title }}】</text>
  9. </view>
  10. <view><rich-text :nodes="item.contents"></rich-text></view>
  11. </view>
  12. </template>
  13. <script>
  14. export default {
  15. data() {
  16. return {
  17. item: {}
  18. };
  19. },
  20. onLoad(e) {
  21. this.$http.request({
  22. url: this.$http.urls.news_detail + e.id,
  23. success: res => {
  24. this.item = res.data.data;
  25. this.item.contents = res.data.data.contents.replace(/\<img/gi, '<img class="rich-img"');
  26. }
  27. });
  28. },
  29. methods: {
  30. //分享
  31. share() {}
  32. }
  33. };
  34. </script>
  35. <style lang="scss">
  36. page {
  37. background-color: white !important;
  38. }
  39. .time {
  40. color: #818184;
  41. padding-bottom: 12px;
  42. font-size: 14px;
  43. .views {
  44. padding-left: 20px;
  45. float: right;
  46. }
  47. }
  48. .title {
  49. padding-top: 8px;
  50. font-size: 23px;
  51. font-weight: 400;
  52. margin-bottom: 20px;
  53. }
  54. .contents {
  55. padding: 20px;
  56. }
  57. </style>