Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ai-chat-ui
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenghong_tao
ai-chat-ui
Commits
d076a3ee
Commit
d076a3ee
authored
Apr 25, 2025
by
chenghong_tao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加防抖函数
parent
a79026df
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
markdownRender.vue
src/components/markdown/markdownRender.vue
+11
-2
No files found.
src/components/markdown/markdownRender.vue
View file @
d076a3ee
...
...
@@ -62,9 +62,9 @@ md.use((md) => {
myChart
.
setOption
(
option
);
// 监听窗口大小变化事件
const
resizeHandler
=
()
=>
{
const
resizeHandler
=
debounce
(
()
=>
{
myChart
.
resize
();
}
;
}
,
300
);
// 调整延迟时间
window
.
addEventListener
(
"resize"
,
resizeHandler
);
// 清理事件监听器
...
...
@@ -89,6 +89,15 @@ md.use((md) => {
const
renderedContent
=
computed
(()
=>
{
return
md
.
render
(
props
.
content
);
});
// 自定义防抖函数
function
debounce
(
func
,
wait
)
{
let
timeout
;
return
function
(...
args
)
{
clearTimeout
(
timeout
);
timeout
=
setTimeout
(()
=>
func
.
apply
(
this
,
args
),
wait
);
};
}
</
script
>
<
style
lang=
"less"
scoped
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment