s-richtext-block.vue 887 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!-- 装修营销组件:营销文章 -->
  2. <template>
  3. <view
  4. :style="[
  5. {
  6. marginLeft: styles.marginLeft + 'px',
  7. marginRight: styles.marginRight + 'px',
  8. marginBottom: styles.marginBottom + 'px',
  9. marginTop: styles.marginTop + 'px',
  10. padding: styles.padding + 'px',
  11. },
  12. ]"
  13. >
  14. <mp-html class="richtext" :content="state.content"></mp-html>
  15. </view>
  16. </template>
  17. <script setup>
  18. import { reactive, onMounted } from 'vue';
  19. import ArticleApi from '@/sheep/api/promotion/article';
  20. const props = defineProps({
  21. data: {
  22. type: Object,
  23. default: {},
  24. },
  25. styles: {
  26. type: Object,
  27. default() {},
  28. },
  29. });
  30. const state = reactive({
  31. content: '',
  32. });
  33. onMounted(async () => {
  34. const { data } = await ArticleApi.getArticle(props.data.id);
  35. state.content = data.content;
  36. });
  37. </script>