|
|
@@ -20,7 +20,7 @@
|
|
|
<span>{{ formatDate(data.publishdate, 'YYYY-MM-DD') }}</span>
|
|
|
<span style="margin-left: auto;">阅览数:{{ data.hits }}</span>
|
|
|
</h4>
|
|
|
- <p ref="htmlRef" v-html="formatHtmlString(data.context)"></p>
|
|
|
+ <HtmlContainer :context="data.context" v-if="data.context" />
|
|
|
<p style="color: #999;margin-top: .24rem;font-size: .24rem;" v-if="data.author">作者:{{ data.author }}</p>
|
|
|
</section>
|
|
|
<template v-if="dataList.length">
|
|
|
@@ -37,16 +37,15 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { shallowRef, nextTick } from 'vue'
|
|
|
-import { CellGroup, Cell, Divider, showImagePreview, showFailToast, showToast, Icon } from 'vant'
|
|
|
-import { formatDate, formatHtmlString, getImageSrc, getFileUrl, getNewsShareUrl } from '@/filters'
|
|
|
+import { CellGroup, Cell, Divider, showFailToast, showToast, Icon } from 'vant'
|
|
|
+import { formatDate, getFileUrl, getNewsShareUrl } from '@/filters'
|
|
|
import { useNavigation } from '@/hooks/navigation'
|
|
|
import { useRequest } from '@/hooks/request'
|
|
|
import { queryNewTitles, queryNewContents } from '@/services/api/news'
|
|
|
import plus from '@/utils/h5plus'
|
|
|
+import HtmlContainer from '@mobile/components/base/html-container/index.vue'
|
|
|
|
|
|
const { getQueryString } = useNavigation()
|
|
|
-const htmlRef = shallowRef<HTMLElement>()
|
|
|
const newsId = getQueryString('id')
|
|
|
|
|
|
const { dataList, run } = useRequest(queryNewTitles, {
|
|
|
@@ -67,26 +66,6 @@ const { data } = useRequest(queryNewContents, {
|
|
|
if (res.data.length) {
|
|
|
const details = res.data[0]
|
|
|
data.value = details
|
|
|
-
|
|
|
- nextTick(() => {
|
|
|
- const el = htmlRef.value
|
|
|
- if (el) {
|
|
|
- el.querySelectorAll('img').forEach((e, i) => {
|
|
|
- e.onclick = () => {
|
|
|
- showImagePreview({
|
|
|
- images: getImageSrc(details.context),
|
|
|
- startPosition: i,
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- el.querySelectorAll('a').forEach((e) => {
|
|
|
- const href = e.href
|
|
|
- e.onclick = () => plus.openURL(href)
|
|
|
- e.removeAttribute('href')
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
run({ columnid: details.columnid })
|
|
|
} else {
|
|
|
run()
|