zhengyiming
2 天以前 7d8aa8e552a7ae8a1c5c60d1daae233da3ca0275
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
47
48
<template>
  <div :class="['rich-edit-content', size]">
    <template v-for="(item, index) in content" :key="index">
      <!-- <AutoWidthImage
        v-if="item.type === LifeRechargeConstants.EditorType.Image"
        wrapperClassName="rich-content-item rich-content-image-item"
        :src="setOSSLink(item.path)"
      /> -->
      <PreviewImage
        v-if="item.type === LifeRechargeConstants.EditorType.Image"
        wrapperClassName="rich-content-item rich-content-image-item"
        :src="setOSSLink(item.path)"
        style="max-width: 100%"
        mode="widthFix"
      />
      <Video
        v-else-if="item.type === LifeRechargeConstants.EditorType.Video"
        class="rich-content-item rich-content-video-item"
        :src="setOSSLink(item.path)"
      ></Video>
      <div v-else class="rich-content-item rich-content-text-item">
        {{ item.content }}
      </div>
    </template>
  </div>
</template>
 
<script setup lang="ts">
import AutoWidthImage from '../Image/AutoWidthImage.vue';
import { Video } from '@tarojs/components';
import { LifeRechargeConstants, LifePayIntroInfoOutput } from '@life-payment/core-vue';
import { setOSSLink } from '../../utils';
import PreviewImage from '../Image/PreviewImage.vue';
 
defineOptions({
  name: 'RichContent',
});
 
type Props = {
  content?: LifePayIntroInfoOutput[];
  size?: 'small' | 'default' | 'large';
};
 
const props = withDefaults(defineProps<Props>(), {
  content: () => [],
  size: 'default',
});
</script>