fix(biji-qianduan): 修复保存成功后不退出编辑页面等问题
- 注释掉保存成功后退出编辑页面的代码- 注释掉保存成功后清空 editData 的代码 -优化 NoteEditor 组件中的保存逻辑 - 修复保存失败时的错误提示信息
This commit is contained in:
@@ -276,7 +276,8 @@ const handleEditorBack = (data) => {
|
||||
|
||||
const handleSaveSuccess = (updatedFile) => {
|
||||
selectedFile.value = updatedFile;
|
||||
showEditor.value = false;
|
||||
// 修复:保存成功后不退出编辑页面
|
||||
// showEditor.value = false;
|
||||
|
||||
const index = groupMarkdownFiles.value.findIndex(f => f.id === updatedFile.id);
|
||||
if (index !== -1) {
|
||||
@@ -290,7 +291,8 @@ const handleSaveSuccess = (updatedFile) => {
|
||||
// 延迟清空 editData,确保所有响应式更新完成后再清理状态
|
||||
// Delay clearing editData to ensure all reactive updates are complete before cleaning up the state.
|
||||
setTimeout(() => {
|
||||
resetEdit();
|
||||
// 修复:保存成功后不清空editData,保持编辑状态
|
||||
// resetEdit();
|
||||
}, 100); // A short delay is usually sufficient
|
||||
};
|
||||
|
||||
|
||||
@@ -89,17 +89,14 @@ const save = async (value) => {
|
||||
const content = typeof value === 'string' ? value : vditor.value.getValue();
|
||||
try {
|
||||
saveStatus.value = '正在保存...';
|
||||
const res = await updateMarkdown({ id: props.editData.id, content: content });
|
||||
if (res.code === 200) {
|
||||
saveStatus.value = '已保存';
|
||||
emit('update:editData', { ...props.editData, content: content });
|
||||
} else {
|
||||
saveStatus.value = '保存失败';
|
||||
ElMessage.error(res.message || '保存失败');
|
||||
}
|
||||
await updateMarkdown({ id: props.editData.id, content: content });
|
||||
// 保存成功,更新状态
|
||||
saveStatus.value = '已保存';
|
||||
emit('update:editData', { ...props.editData, content: content });
|
||||
} catch (error) {
|
||||
// 保存失败,更新状态并显示错误消息
|
||||
saveStatus.value = '保存失败';
|
||||
ElMessage.error('保存失败');
|
||||
ElMessage.error('保存失败: ' + (error.message || '未知错误'));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
BIN
mydatabase.db
BIN
mydatabase.db
Binary file not shown.
Reference in New Issue
Block a user