Articledetail.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <home-base :show="false"><view class="div distributor-article-list">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar :title="article_title" class="common-header" left-icon="back" @clickLeft="goBack()">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class='main-content'>
  13. <rich-text class="div article_content" :nodes='article_content'></rich-text>
  14. </view>
  15. </view></home-base>
  16. </template>
  17. <script>
  18. import {getFontSize} from '@/util/common'
  19. import TitleHeader from '../../TitleHeader'
  20. import HomeBase from '../HomeBase'
  21. import { getArticleDetail } from '../../../api/homeArticle'
  22. export default {
  23. name:'HomeDocument',
  24. mounted(){
  25. // #ifdef MP-WEIXIN
  26. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  27. // #endif
  28. },
  29. computed:{
  30. fontSize(){
  31. return getFontSize()
  32. },
  33. },
  34. data(){
  35. return {
  36. navHeight: 0,
  37. article_title: '',
  38. article_content: ''
  39. }
  40. },
  41. components:{
  42. TitleHeader,
  43. HomeBase,
  44. },
  45. onLoad: function (option) {
  46. let article_id = option.article_id
  47. getArticleDetail(article_id).then(res => {
  48. this.article_title = res.result.article_title
  49. this.article_content = res.result.article_content
  50. }).catch(function (error) {
  51. uni.showToast({icon:'none',title: error.message})
  52. })
  53. },
  54. methods:{
  55. goBack(){
  56. uni.navigateBack({delta:1})
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" >
  62. .main-content{padding: 0 $pageSpace;box-sizing: border-box;}
  63. .article_content{padding:.5rem;font-size:$subFontSize;line-height:1rem;}
  64. .article_content .img{width: 100%}
  65. </style>