mall-uniapp/sheep/components/s-richtext-block/s-richtext-block.vue

41 lines
887 B
Vue
Raw Permalink Normal View History

2023-12-19 15:10:50 +00:00
<!-- 装修营销组件营销文章 -->
2022-11-22 07:45:36 +00:00
<template>
<view
:style="[
{
marginLeft: styles.marginLeft + 'px',
marginRight: styles.marginRight + 'px',
marginBottom: styles.marginBottom + 'px',
marginTop: styles.marginTop + 'px',
padding: styles.padding + 'px',
},
]"
>
<mp-html class="richtext" :content="state.content"></mp-html>
2022-11-22 07:45:36 +00:00
</view>
</template>
<script setup>
import { reactive, onMounted } from 'vue';
import ArticleApi from '@/sheep/api/promotion/article';
2023-12-19 15:10:50 +00:00
2022-11-22 07:45:36 +00:00
const props = defineProps({
data: {
type: Object,
default: {},
},
styles: {
type: Object,
default() {},
},
});
2023-12-19 15:10:50 +00:00
2022-11-22 07:45:36 +00:00
const state = reactive({
content: '',
});
2023-12-19 15:10:50 +00:00
2022-11-22 07:45:36 +00:00
onMounted(async () => {
const { data } = await ArticleApi.getArticle(props.data.id);
state.content = data.content;
2022-11-22 07:45:36 +00:00
});
</script>