index.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view>
  3. <view id="box">
  4. <u-parse :content="content" :noData="content" v-if="isShow" :imageProp="imageProp" />
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import uParse from '@/components/gaoyia-parse/parse.vue'
  10. export default {
  11. components: {
  12. uParse
  13. },
  14. data () {
  15. return {
  16. content: "",
  17. isShow: false,
  18. imageProp:{
  19. mode: 'aspectFit',
  20. padding: 0,
  21. lazyLoad: false,
  22. domain: ''
  23. }
  24. }
  25. },
  26. onLoad (options) {
  27. this.id = options.id || 0;
  28. this.get_article();
  29. },
  30. methods: {
  31. get_article () {
  32. this
  33. .request
  34. .post("getContent", {
  35. id: this.id
  36. })
  37. .then(res => {
  38. if (res.code == 200) {
  39. this.content = res.data.content;
  40. uni.setNavigationBarTitle({
  41. title: res.data.title
  42. });
  43. this.isShow = true;
  44. }
  45. })
  46. .catch(err => {
  47. this.utils.Tip("网络错误,请稍后尝试");
  48. });
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. @import url("/components/gaoyia-parse/parse.css");
  55. #box {
  56. z-index: -1;
  57. padding: 15px;
  58. }
  59. /deep/ {
  60. /* #ifndef APP */
  61. .img {
  62. display: block !important;
  63. width: 100%;
  64. }
  65. /* #endif */
  66. }
  67. </style>