detail.vue 858 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <block>
  3. <rich-text :nodes="content.content"></rich-text>
  4. </block>
  5. </template>
  6. <script>
  7. // pages/tabbar/index/index.js
  8. var app = getApp();
  9. export default {
  10. data() {
  11. return {
  12. content:""
  13. };
  14. },
  15. onLoad: function(options) {
  16. this.id = options.id;
  17. this.getinfo()
  18. },
  19. onShow() {
  20. },
  21. onPullDownRefresh: function() {},
  22. onReachBottom: function() {
  23. },
  24. onShareAppMessage: function() {},
  25. methods: {
  26. async getinfo() {
  27. var that = this;
  28. let res = await this.$api.request('/article/detail', 'GET', {
  29. id: this.id,
  30. });
  31. res.content = res.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"');
  32. this.content = res
  33. }
  34. }
  35. };
  36. </script>
  37. <style>
  38. page {
  39. background: #F5F5F5;
  40. padding: 20rpx;
  41. box-sizing: border-box;
  42. }
  43. </style>