From 218379aa6a22995bd0fd51a30f0b6b9253746669 Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期一, 12 五月 2025 10:32:04 +0800 Subject: [PATCH] ai工业大模型代码提交 --- src/components/MarkdownView/index.vue | 32 ++++++++++++++++++++++++-------- 1 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/components/MarkdownView/index.vue b/src/components/MarkdownView/index.vue index 74764d5..0b1837f 100644 --- a/src/components/MarkdownView/index.vue +++ b/src/components/MarkdownView/index.vue @@ -34,8 +34,13 @@ /** 渲染 markdown */ const renderedMarkdown = computed(() => { - return md.render(props.content) + return formatContent(props.content) }) + +/** 保留换行符 */ +const formatContent = (text) => { + return text.replace(/\n/g, '<br>') +} /** 初始化 **/ onMounted(async () => { @@ -51,14 +56,25 @@ <style lang="scss"> .markdown-view { - font-family: PingFang SC; - font-size: 0.95rem; - font-weight: 400; - line-height: 1.6rem; - letter-spacing: 0em; - text-align: left; - color: #3b3e55; max-width: 100%; + overflow-y: auto; /* 垂直方向溢出时显示滚动条 */ + overflow-x: hidden; /* 水平方向隐藏滚动条 */ + + /* Firefox */ + scrollbar-width: thin; + scrollbar-color: rgba(0, 0, 0, 0.15) transparent; + + /* WebKit */ + &::-webkit-scrollbar { + width: 6px; + background: transparent; + } + &::-webkit-scrollbar-thumb { + border-radius: 4px; + background: rgba(0, 0, 0, 0.15); + transition: background 0.3s; + &:hover { background: rgba(0, 0, 0, 0.25); } + } pre { position: relative; -- Gitblit v1.9.3