From 3720b5667d3905a15b65bcb714145fa9123f04f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Tue, 14 Oct 2025 15:32:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(portal):=20=E5=AE=9E=E7=8E=B0=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E7=BB=84=E4=BB=B6=E6=94=AF=E6=8C=81=20Mermaid=20?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 markdown-it-mermaid 插件支持 Mermaid 语法 - 集成 mermaid 库并初始化配置 - 实现打字机效果与 Mermaid 渲染结合 -优化案例引用展示逻辑与样式- 添加推荐问题展示功能 - 改进消息组件的响应式与样式细节 - 修复组件销毁时定时器未清除的问题 - 更新依赖包引入 Mermaid 相关库 --- package.json | 3 + src/views/portal/case/components/messages.vue | 542 +++++++++++------- vue.config.js | 7 + 3 files changed, 332 insertions(+), 220 deletions(-) diff --git a/package.json b/package.json index affc1572..bd712969 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@mermaid-js/parser": "^0.6.3", "axios": "^0.21.4", "core-js": "^3.6.5", "driver.js": "^0.9.8", @@ -30,6 +31,8 @@ "katex": "^0.16.25", "markdown-it": "^14.1.0", "markdown-it-highlightjs": "^4.2.0", + "markdown-it-mermaid": "^0.2.5", + "mermaid": "^8.13.10", "mockjs": "^1.1.0", "moment": "^2.29.1", "nprogress": "^0.2.0", diff --git a/src/views/portal/case/components/messages.vue b/src/views/portal/case/components/messages.vue index 9dc9e171..06f0e9e6 100644 --- a/src/views/portal/case/components/messages.vue +++ b/src/views/portal/case/components/messages.vue @@ -1,176 +1,218 @@ - + + - - diff --git a/vue.config.js b/vue.config.js index 3d7a6e1c..1605589f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -57,6 +57,13 @@ module.exports = { // set svg-sprite-loader config.plugins.delete('preload') config.plugins.delete('prefetch') + // 添加对 mathxyjax3 的处理规则 + config.module + .rule('mathxyjax3') + .test(/node_modules[\/\\]mathxyjax3[\/\\].*\.js$/) + .use('null-loader') + .loader('null-loader') + .end() config.module .rule('svg') .exclude.add(resolve('src/icons'))