You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

3 years ago
  1. <template>
  2. <view class="app column">
  3. <jyf-parser
  4. ref="article"
  5. :html="data.content"
  6. lazy-load
  7. show-with-animation
  8. ></jyf-parser>
  9. <mix-loading v-if="isLoading" :type="2"></mix-loading>
  10. </view>
  11. </template>
  12. <script>
  13. import jyfParser from '@/components/jyf-parser/jyf-parser.vue'
  14. export default {
  15. components: {
  16. jyfParser
  17. },
  18. data() {
  19. return {
  20. data: {}
  21. }
  22. },
  23. async onLoad(options) {
  24. const param = JSON.parse(options.param);
  25. this.loadData(param);
  26. },
  27. methods: {
  28. async loadData(param){
  29. const {module, operation, data} = param;
  30. const res = await this.$request(module, operation, data, {
  31. showLoading: true
  32. })
  33. if(res.status === 0){
  34. this.$util.msg(res.msg || '获取失败');
  35. setTimeout(()=>{
  36. uni.navigateBack();
  37. }, 1000)
  38. }
  39. uni.setNavigationBarTitle({
  40. title: res.data.name
  41. })
  42. this.data = {
  43. ...res.data,
  44. content: res.data.content.replace(/\<img/gi, '<img style="width:100%;height:auto;max-width:750rpx;border-radius: 6rpx"')
  45. }
  46. }
  47. }
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .app{
  52. padding: 10rpx 30rpx 30rpx;
  53. font-size: 30rpx;
  54. color: #333;
  55. line-height: 46rpx;
  56. }
  57. </style>