【代码优化】AI:markdown 组件,增加相关的注释
parent
cb02377706
commit
a805ceb534
|
@ -27,6 +27,9 @@ const include = [
|
||||||
'echarts-wordcloud',
|
'echarts-wordcloud',
|
||||||
'@wangeditor/editor',
|
'@wangeditor/editor',
|
||||||
'@wangeditor/editor-for-vue',
|
'@wangeditor/editor-for-vue',
|
||||||
|
'@microsoft/fetch-event-source',
|
||||||
|
'markdown-it',
|
||||||
|
'highlight.js',
|
||||||
'element-plus',
|
'element-plus',
|
||||||
'element-plus/es',
|
'element-plus/es',
|
||||||
'element-plus/es/locale/lang/zh-cn',
|
'element-plus/es/locale/lang/zh-cn',
|
||||||
|
@ -104,7 +107,11 @@ const include = [
|
||||||
'element-plus/es/components/collapse/style/css',
|
'element-plus/es/components/collapse/style/css',
|
||||||
'element-plus/es/components/collapse-item/style/css',
|
'element-plus/es/components/collapse-item/style/css',
|
||||||
'element-plus/es/components/button-group/style/css',
|
'element-plus/es/components/button-group/style/css',
|
||||||
'element-plus/es/components/text/style/css'
|
'element-plus/es/components/text/style/css',
|
||||||
|
'element-plus/es/components/segmented/style/css',
|
||||||
|
'@element-plus/icons-vue',
|
||||||
|
'element-plus/es/components/footer/style/css',
|
||||||
|
'element-plus/es/components/empty/style/css'
|
||||||
]
|
]
|
||||||
|
|
||||||
const exclude = ['@iconify/json']
|
const exclude = ['@iconify/json']
|
||||||
|
|
3152
pnpm-lock.yaml
3152
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- <div ref="contentRef" class="markdown-view" v-html="contentHtml"></div>-->
|
|
||||||
<div ref="contentRef" class="markdown-view" v-html="renderedMarkdown"></div>
|
<div ref="contentRef" class="markdown-view" v-html="renderedMarkdown"></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {useClipboard} from '@vueuse/core'
|
import { useClipboard } from '@vueuse/core'
|
||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import 'highlight.js/styles/vs2015.min.css'
|
import 'highlight.js/styles/vs2015.min.css'
|
||||||
import hljs from 'highlight.js'
|
import hljs from 'highlight.js'
|
||||||
|
@ -20,7 +19,6 @@ const props = defineProps({
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { copy } = useClipboard() // 初始化 copy 到粘贴板
|
const { copy } = useClipboard() // 初始化 copy 到粘贴板
|
||||||
const contentRef = ref()
|
const contentRef = ref()
|
||||||
const { content } = toRefs(props) // 将 props 变为引用类型
|
|
||||||
|
|
||||||
const md = new MarkdownIt({
|
const md = new MarkdownIt({
|
||||||
highlight: function (str, lang) {
|
highlight: function (str, lang) {
|
||||||
|
@ -32,11 +30,12 @@ const md = new MarkdownIt({
|
||||||
}
|
}
|
||||||
return ``
|
return ``
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
|
/** 渲染 markdown */
|
||||||
const renderedMarkdown = computed(() => {
|
const renderedMarkdown = computed(() => {
|
||||||
return md.render(props.content);
|
return md.render(props.content)
|
||||||
});
|
})
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|
|
@ -4,10 +4,10 @@
|
||||||
<ConversationList
|
<ConversationList
|
||||||
:active-id="activeConversationId"
|
:active-id="activeConversationId"
|
||||||
ref="conversationListRef"
|
ref="conversationListRef"
|
||||||
@onConversationCreate="handleConversationCreateSuccess"
|
@on-conversation-create="handleConversationCreateSuccess"
|
||||||
@onConversationClick="handleConversationClick"
|
@on-conversation-click="handleConversationClick"
|
||||||
@onConversationClear="handleConversationClear"
|
@on-conversation-clear="handleConversationClear"
|
||||||
@onConversationDelete="handlerConversationDelete"
|
@on-conversation-delete="handlerConversationDelete"
|
||||||
/>
|
/>
|
||||||
<!-- 右侧:对话详情 -->
|
<!-- 右侧:对话详情 -->
|
||||||
<el-container class="detail-container">
|
<el-container class="detail-container">
|
||||||
|
|
Loading…
Reference in New Issue