Browse Source

add clear deck

Mistivia 2 weeks ago
parent
commit
5a7e89205e
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/components/main_panel.svelte

+ 9 - 0
src/components/main_panel.svelte

@@ -27,6 +27,14 @@
         }
     }
 
+    function clearDeck() {
+        setDeck({
+            'main': [],
+            'extra': [],
+            'side': [],
+        });
+    }
+
     function saveDeck() {
         let deckString = genYdk($deck);
         downloadStringAsFile(deckString)
@@ -85,6 +93,7 @@
     <div class="control-bar">
         <button class="btn" onclick={openDeck}>打开</button>
         <button class="btn" onclick={saveDeck}>保存</button>
+        <button class="btn" onclick={clearDeck}>清空</button>
         <button class="btn" onclick={copyDeck}>复制到剪贴板</button>
         <button class="btn" onclick={shareDeck}>分享</button>
         <select bind:value={$format} class="select-format" id="format" onchange={()=>setFormat($format)}>