Skip to content

Commit ac508d5

Browse files
committed
feat: 添加自定义卡片内容为空时删除卡片的功能
1 parent 1831c91 commit ac508d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/pages/index.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,16 @@ export default {
11431143
this.state.boardData.homework[this.currentEditSubject]?.content || "";
11441144
11451145
if (content !== originalContent.trim()) {
1146+
// 如果内容为空且是自定义卡片,则删除该卡片
1147+
if (!content && this.currentEditSubject.startsWith('custom-')) {
1148+
delete this.state.boardData.homework[this.currentEditSubject];
1149+
this.state.synced = false;
1150+
if (this.autoSave) {
1151+
await this.trySave(true);
1152+
}
1153+
this.state.dialogVisible = false;
1154+
return;
1155+
}
11461156
// 如果是自定义卡片,保留其他属性
11471157
if (this.state.boardData.homework[this.currentEditSubject].type === 'custom') {
11481158
this.state.boardData.homework[this.currentEditSubject].content = content;

0 commit comments

Comments
 (0)