feat:富文本问题

This commit is contained in:
dzc committed 2026-05-13 17:16:21 +08:00
1 parent 11389462df
commit 073797c3bf
4 files changed
+54 -26

No files matched your search

+5 -16
View File
@@ -13,14 +13,8 @@
</view>
<view v-if="imageList.length" class="image-list">
<image
v-for="(src, index) in imageList"
:key="index"
class="detail-image"
:src="src"
mode="aspectFill"
@tap="previewImage(index)"
/>
<image v-for="(src, index) in imageList" :key="index" class="detail-image" :src="src" mode="aspectFill"
@tap="previewImage(index)" />
</view>
<view class="detail-section">
@@ -95,8 +89,8 @@ const imageList = computed(() => {
const rawList = Array.isArray(imgs)
? imgs
: imgs
.split(',')
.map((item) => item.trim())
.split(',')
.map((item) => item.trim())
return rawList
.map((item) => toAbsoluteUrl(item))
@@ -106,11 +100,7 @@ const imageList = computed(() => {
const descriptionNodes = computed(() => {
const desc = detail.value?.description
if (!desc) return ''
return desc.replace(/<img\s+[^>]*src=["']([^"']+)["']/gi, (match, src) => {
const fullSrc = toAbsoluteUrl(src)
if (!fullSrc) return match
return match.replace(src, fullSrc)
})
return desc?.replaceAll(`<img src="/api`, `<img src="https://stgl.pj.gov.cn/api`)
})
const contactInfo = computed(() => {
@@ -274,4 +264,3 @@ onLoad((options: Record<string, any>) => {
white-space: pre-wrap;
}
</style>
+1 -5
View File
@@ -31,11 +31,7 @@ const toAbsoluteUrl = (url?: string | null) => {
const richTextNodes = computed(() => {
const html = detail.value.richTextContent
if (!html) return ""
return html.replace(/<img\s+[^>]*src=["']([^"']+)["']/gi, (match, src) => {
const fullSrc = toAbsoluteUrl(src)
if (!fullSrc) return match
return match.replace(src, fullSrc)
})
return html?.replaceAll(`<img src="/api`, `<img src="https://stgl.pj.gov.cn/api`)
})
onLoad(async (options: any) => {