This commit is contained in:
pengxiaolong
2025-05-13 19:39:53 +08:00
parent 37da6765b8
commit c006a8e63d
1232 changed files with 96963 additions and 883 deletions

View File

@@ -0,0 +1,62 @@
<template>
<div
class="rich-text"
v-html="formatedContent"
/>
</template>
<script lang="ts">
import vue from '../adapter-vue';
import { marked } from 'marked';
import { customerServicePayloadType } from '../interface';
const { computed } = vue;
interface Props {
payload: customerServicePayloadType;
}
export default {
props: {
payload: {
type: Object as () => customerServicePayloadType,
default: () => ({}),
},
},
setup(props: Props) {
const formatedContent = computed(() => {
let richtext = marked.parse(props.payload.content);
const regex = new RegExp('<img', 'gi');
richtext = richtext.replace(regex, `<img style="max-width: 100%;"`);
return richtext;
});
return {
props,
formatedContent,
};
},
};
</script>
<style lang="scss">
.rich-text {
div,
ul,
ol,
dt,
dd,
li,
dl,
h1,
h2,
h3,
h4,
p,
img,
a {
max-width: 100%;
}
a {
color: blue;
}
}
</style>