Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
corporate-culture-qd
Overview
Overview
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
王立鹏
corporate-culture-qd
Commits
3cf73794
Commit
3cf73794
authored
Oct 08, 2026
by
lijiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【需求 25171】fix: 编辑文章时抽屉表单未渲染导致回显丢失,改为子表单挂载后再回填
parent
0a5e9a57
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
+17
-1
index.vue
src/views/publishLongArticle/index.vue
+17
-1
No files found.
src/views/publishLongArticle/index.vue
View file @
3cf73794
...
...
@@ -128,6 +128,7 @@ import WangEditor from '@/components/common/WangEditor/index.vue'
import
{
ArticleTypeEnum
,
ReleaseStatusTypeEnum
,
articleTypeListOptions
}
from
'@/constants'
import
{
useResetData
}
from
'@/hooks'
import
{
addOrUpdateArticle
,
addOrUpdatePractice
,
getArticleDetail
}
from
'@/api'
import
type
{
ArticleItemDto
}
from
'@/api'
import
{
useRouter
,
useRoute
}
from
'vue-router'
import
{
push
}
from
'notivue'
import
BackButton
from
'@/components/common/BackButton/index.vue'
...
...
@@ -162,6 +163,16 @@ const [sharedForm, resetSharedForm] = useResetData({
// 每个类型自己的表单组件,字段/校验/提交数据都在对应组件里,这里只认 ArticleTypeFormExpose 这个接口
const
subFormRef
=
useTemplateRef
<
ArticleTypeFormExpose
>
(
'subFormRef'
)
// el-drawer 的内容要第一次打开时才会渲染,编辑回显时子表单可能还没挂载(subFormRef 是 null),
// 直接 setEchoData 会被静默跳过。先把详情存着,等子表单挂载出来再回填
let
pendingEchoData
:
ArticleItemDto
|
null
=
null
watch
(
subFormRef
,
(
form
)
=>
{
if
(
form
&&
pendingEchoData
)
{
form
.
setEchoData
(
pendingEchoData
)
pendingEchoData
=
null
}
})
// 打开抽屉
const
openDrawer
=
()
=>
{
drawerVisible
.
value
=
true
...
...
@@ -220,6 +231,7 @@ onActivated(async () => {
editorKey
.
value
++
resetSharedForm
()
subFormRef
.
value
?.
reset
()
pendingEchoData
=
null
await
nextTick
()
if
(
!
isEdit
.
value
)
return
...
...
@@ -232,7 +244,11 @@ onActivated(async () => {
title
:
data
.
title
,
content
:
data
.
content
,
}
subFormRef
.
value
?.
setEchoData
(
data
)
if
(
subFormRef
.
value
)
{
subFormRef
.
value
.
setEchoData
(
data
)
}
else
{
pendingEchoData
=
data
}
})
</
script
>
...
...
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