feat: 略微优化markdown渲染
This commit is contained in:
1 parent
05e6e9ec3e
commit
4e1f3c42d2
3 files changed
+54
-5
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<div class="md" v-if="isInit">
|
||||
<div class="md-title">{{ title }}</div>
|
||||
<div class="md-divider"></div>
|
||||
<div v-html="renderedData"></div>
|
||||
<markdown-render :data="content"></markdown-render>
|
||||
</div>
|
||||
<div v-else class="md-skeleton-item">
|
||||
<el-skeleton :rows="12" />
|
||||
@@ -14,6 +14,7 @@
|
||||
<script setup lang="ts">
|
||||
import useMarkdownit from '~/hooks/useMarkdownit';
|
||||
import usePostStore from '~/hooks/pinia/usePostStore';
|
||||
import markdownRender from '~/components/markdownRender.vue';
|
||||
import type { postContent } from '~/types/post';
|
||||
|
||||
const postStore = usePostStore()
|
||||
@@ -24,6 +25,8 @@ const isInit = ref(false)
|
||||
|
||||
const title = ref('')
|
||||
|
||||
const content = ref('')
|
||||
|
||||
const renderedData = ref('')
|
||||
|
||||
const id = route.params.id as string
|
||||
@@ -54,6 +57,8 @@ onMounted(async () => {
|
||||
|
||||
const postsData = await _p
|
||||
|
||||
content.value = postsData.data
|
||||
|
||||
renderedData.value = markdownIt.render(postsData.data)
|
||||
|
||||
title.value = postsData.title
|
||||
|
||||
Reference in new issue
Block a user