This commit is contained in:
启航老齐 2026-03-07 18:24:50 +08:00
parent 399f88dae5
commit 3737874a46
2 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,7 @@
"js-beautify": "1.13.0",
"js-cookie": "3.0.1",
"jsencrypt": "3.0.0-rc.1",
"markdown-it": "^12.3.2",
"nprogress": "0.2.0",
"quill": "1.3.7",
"screenfull": "5.0.2",

View File

@ -132,11 +132,13 @@
<script>
import { todayDaily } from "@/api/report/report";
import { getToken } from "@/utils/auth";
import MarkdownIt from 'markdown-it';
export default {
name: 'Index',
data() {
return {
md: new MarkdownIt(),
inputMessage: '',
messages: [
{
@ -213,8 +215,10 @@ export default {
let messageContent = event.data;
// data:
messageContent = messageContent.replace(/^data:/g, '');
// 使markdown-itmarkdownHTML
const htmlContent = this.md.render(messageContent);
this.messages.push({
content: messageContent,
content: htmlContent,
time: this.formatTime(new Date()),
isMe: false,
avatar: ''