zhengyiming
2025-02-13 2aeb3037ac790c84161a4f6745e0ab7157820a2c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<template>
  <div :class="['rich-edit-content', size]">
    <template v-for="(item, index) in content" :key="index">
      <AutoWidthImage
        v-if="item.type === EditorType.Image"
        wrapperClassName="rich-content-item rich-content-image-item"
        :src="setOSSLink(item.path)"
      />
      <Video
        v-else-if="item.type === EditorType.Video"
        class="rich-content-item rich-content-video-item"
        :src="setOSSLink(item.path)"
      ></Video>
      <RichEditorContent
        v-else-if="item.type === EditorType.Rich || item.type === EditorType.WXContent"
        :content="item.content"
      ></RichEditorContent>
      <div v-else class="rich-content-item rich-content-text-item">
        {{ item.content }}
      </div>
    </template>
  </div>
</template>
 
<script setup lang="ts">
import { AutoWidthImage } from '@12333/components';
import { EditorType } from '@12333/constants';
import { setOSSLink } from '@12333/utils';
import { Video } from '@tarojs/components';
import RichEditorContent from '../RichEditor/RichEditorContent.vue';
// import {} from '@nutui/nutui-taro/dist/packages/video'
 
defineOptions({
  name: 'RichContent',
});
 
type Props = {
  content?: API.IntroInfo[];
  size?: 'small' | 'default' | 'large';
};
 
const props = withDefaults(defineProps<Props>(), {
  content: () => [],
  size: 'default',
});
</script>