Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
najiu-frontend
najiu-admin-template
Commits
35e13470
Commit
35e13470
authored
Jul 13, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(markdown): set `value` error
修复markdown组件在完成初始化之前动态设置value可能导致异常的问题
parent
d95815b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
Markdown.vue
src/components/Markdown/src/Markdown.vue
+7
-8
No files found.
src/components/Markdown/src/Markdown.vue
View file @
35e13470
...
...
@@ -59,8 +59,8 @@
(
v
)
=>
{
if
(
v
!==
valueRef
.
value
)
{
instance
.
getVditor
()?.
setValue
(
v
);
valueRef
.
value
=
v
;
}
valueRef
.
value
=
v
;
}
);
...
...
@@ -85,7 +85,7 @@
const
wrapEl
=
unref
(
wrapRef
)
as
HTMLElement
;
if
(
!
wrapEl
)
return
;
const
bindValue
=
{
...
attrs
,
...
props
};
vditorRef
.
value
=
new
Vditor
(
wrapEl
,
{
const
insEditor
=
new
Vditor
(
wrapEl
,
{
theme
:
getDarkMode
.
value
===
'
dark
'
?
'
dark
'
:
'
classic
'
,
lang
:
unref
(
getCurrentLang
),
mode
:
'
sv
'
,
...
...
@@ -100,7 +100,10 @@
after
:
()
=>
{
nextTick
(()
=>
{
modalFn
?.
redoModalHeight
?.();
insEditor
.
setValue
(
valueRef
.
value
);
vditorRef
.
value
=
insEditor
;
initedRef
.
value
=
true
;
emit
(
'
get
'
,
instance
);
});
},
blur
:
()
=>
{
...
...
@@ -124,14 +127,10 @@
vditorInstance
?.
destroy
?.();
}
catch
(
error
)
{}
vditorRef
.
value
=
null
;
initedRef
.
value
=
false
;
}
onMountedOrActivated
(()
=>
{
nextTick
(()
=>
{
init
();
});
emit
(
'
get
'
,
instance
);
});
onMountedOrActivated
(
init
);
onBeforeUnmount
(
destroy
);
onDeactivated
(
destroy
);
...
...
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