Commit cd16fba5 by lijiabin

styles: 纯文本文章加入换行

parent 98e8a720
...@@ -165,8 +165,13 @@ ...@@ -165,8 +165,13 @@
</div> </div>
<!-- 文章内容 --> <!-- 文章内容 -->
<div v-if="!isHtml" class="prose prose-lg max-w-none"> <div v-if="!isHtml" class="prose prose-lg max-w-none">
<div class="text-gray-700 leading-relaxed space-y-4 whitespace-pre-line text-17px"> <div class="text-gray-700 leading-relaxed space-y-1 text-17px">
{{ articleDetail?.content }} <template v-for="(line, i) in (articleDetail?.content || '').split(/\n/)" :key="i">
<div v-if="line.trim()" class="indent-2em">
{{ line }}
</div>
<div v-else class="h-2" aria-hidden="true" />
</template>
</div> </div>
<!-- 图片内容 --> <!-- 图片内容 -->
......
...@@ -233,7 +233,7 @@ const { play } = useAnimate( ...@@ -233,7 +233,7 @@ const { play } = useAnimate(
}, },
) )
const [form, resetForm] = useResetData({ const [form, , forReset] = useResetData({
title: '', title: '',
content: '', content: '',
imgUrl: '', imgUrl: '',
...@@ -296,7 +296,10 @@ const handlePublish = async (releaseStatus: ReleaseStatusTypeEnum) => { ...@@ -296,7 +296,10 @@ const handlePublish = async (releaseStatus: ReleaseStatusTypeEnum) => {
await textMap[type].api(transformForm(releaseStatus)) await textMap[type].api(transformForm(releaseStatus))
loading.value = false loading.value = false
push.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功') push.success(releaseStatus === ReleaseStatusTypeEnum.PUBLISH ? '发布成功' : '存草稿成功')
resetForm() // resetForm()
forReset()
// form.value.imgUrl = ''
console.log(form.value)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment