提交 1ae48482 作者: 施汉文

fix(popup/report): 修复举报弹窗组件回显异常问题

上级 0dcfcc50
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
> >
<el-form-item label="主游戏" prop="main_game_id"> <el-form-item label="主游戏" prop="main_game_id">
<mainGameSelect <mainGameSelect
:key="`main-game-${formKey}`"
label="" label=""
:default-value="reportForm.main_game_id" :default-value="reportForm.main_game_id"
style="width: 100%" style="width: 100%"
...@@ -138,6 +139,7 @@ ...@@ -138,6 +139,7 @@
</span> </span>
</div> </div>
<textEditor <textEditor
:key="`text-editor-${formKey}`"
ref="textEditorRef" ref="textEditorRef"
:remark.sync="reportForm.remark" :remark.sync="reportForm.remark"
domid="report_content" domid="report_content"
...@@ -346,7 +348,8 @@ ...@@ -346,7 +348,8 @@
searchUserOption: [], searchUserOption: [],
eco_user_list: [], // 生态运营人员列表 eco_user_list: [], // 生态运营人员列表
initialFormSnapshot: '', // 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改 initialFormSnapshot: '', // 举报抽屉缓存:打开时快照,用于关闭时对比是否有修改
isClosing: false // 关闭重入守卫:el-drawer 在 visible 被程序置 false 时会再次 emit close,避免 close() 二次执行 isClosing: false, // 关闭重入守卫:el-drawer 在 visible 被程序置 false 时会再次 emit close,避免 close() 二次执行
formKey: 0 // 子组件强制重建标识:mainGameSelect/textEditor 不随 reportForm prop 复位(前者空值不清、后者仅 mounted 读一次),每次打开自增以销毁重建,确保提交/缓存恢复后回显正确
} }
}, },
watch: { watch: {
...@@ -369,6 +372,9 @@ ...@@ -369,6 +372,9 @@
this.reportForm = this.$clone(cache) this.reportForm = this.$clone(cache)
} }
} }
// 子组件强制重建:reportForm 已重置/回填/恢复落定,自增 key 让 mainGameSelect/textEditor
// 销毁重建,按最新 reportForm 重新初始化(否则提交后或缓存恢复时主游戏、详情会残留旧值)
this.formKey++
// 举报抽屉缓存:建立初始快照基线(回填/恢复落定后),关闭时据此判断是否有未提交修改 // 举报抽屉缓存:建立初始快照基线(回填/恢复落定后),关闭时据此判断是否有未提交修改
this.$nextTick(() => { this.$nextTick(() => {
this.initialFormSnapshot = JSON.stringify(this.reportForm) this.initialFormSnapshot = JSON.stringify(this.reportForm)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论