richText.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <template>
  2. <!-- 富文本 -->
  3. <view v-show="!isSortType">
  4. <view class='richText' :style="'background-color:'+bgColor+';margin:'+ udConfig +'rpx '+ lrConfig +'rpx;'" v-if="description">
  5. <jyf-parser :html="description" ref="article" :tag-style="tagStyle"></jyf-parser>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import parser from "@/components/jyf-parser/jyf-parser";
  11. export default {
  12. name: 'richText',
  13. props: {
  14. dataConfig: {
  15. type: Object,
  16. default: () => {}
  17. },
  18. isSortType:{
  19. type: String | Number,
  20. default:0
  21. }
  22. },
  23. components: {
  24. "jyf-parser": parser
  25. },
  26. data() {
  27. return {
  28. tagStyle: {
  29. img: 'width:100%;display:block;',
  30. table: 'width:100%',
  31. video: 'width:100%'
  32. },
  33. bgColor:this.dataConfig.bgColor.color[0].item,
  34. lrConfig:this.dataConfig.lrConfig.val,
  35. description:this.dataConfig.richText.val,
  36. udConfig:this.dataConfig.udConfig.val
  37. };
  38. },
  39. created() {},
  40. methods: {
  41. }
  42. }
  43. </script>
  44. <style lang="scss">
  45. .richText{
  46. padding: 20rpx;
  47. background-color: #fff;
  48. margin: 0 20rpx;
  49. border-radius: 24rpx;
  50. }
  51. /deep/uni-video{
  52. width: 100%!important;
  53. }
  54. /deep/video{
  55. width: 100%!important;
  56. }
  57. </style>