From 1cd891833c4c4da8ccf7bf2c86ac343b4c1ca7a1 Mon Sep 17 00:00:00 2001 From: "ethan.chen" Date: Mon, 26 May 2025 18:32:42 +0800 Subject: [PATCH] feat: reset media form fields when modal is shown in MediaFormModal component --- src/lib/MediaFormModal.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/lib/MediaFormModal.svelte b/src/lib/MediaFormModal.svelte index b7c5f5b..d8711ff 100644 --- a/src/lib/MediaFormModal.svelte +++ b/src/lib/MediaFormModal.svelte @@ -12,7 +12,19 @@ platform: '', notes: '' }); - + $effect(() => { + if (show) { + media = { + title: '', + type: '', + status: 'plan_to_watch', + date: '', + rating: 0, + platform: '', + notes: '' + }; + } + }); const statusOptions = [ { value: 'plan_to_watch', label: '计划中' }, { value: 'in_progress', label: '进行中' },