content.vue 980 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <view>
  3. <view class="u-content">
  4. <u-parse :autosetTitle="true"
  5. :html="content"
  6. :selectable="true"
  7. :show-with-animation="true"></u-parse>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. title: '开源字节',
  16. content: ``
  17. }
  18. },
  19. onLoad(option) {
  20. let id = option.id
  21. let url = "/api/cmsApi/getArticle/" + id;
  22. this.$u.get(url).then(res => {
  23. this.title = res.data.smallTitle
  24. this.content = res.data.articleContent
  25. uni.setNavigationBarTitle({
  26. title: this.title
  27. })
  28. });
  29. },
  30. methods: {
  31. goIndex() {
  32. this.$u.route('/pages/index/index');
  33. },
  34. }
  35. }
  36. </script>
  37. <style>
  38. page {
  39. background-color: #FFFFFF;
  40. }
  41. </style>
  42. <style lang="scss" scoped>
  43. .u-content {
  44. margin: 0 10 rpx;
  45. padding: 24 rpx;
  46. font-size: 34 rpx;
  47. color: $u-main-color;
  48. line-height: 1.8;
  49. white-space: pre-wrap !important;
  50. }
  51. </style>