added save and load json
This commit is contained in:
@@ -158,16 +158,36 @@
|
||||
{/each}
|
||||
</table>
|
||||
<div class="save-load-clear-group">
|
||||
<button>Save</button>
|
||||
<button>Load</button><br />
|
||||
<button
|
||||
on:click={() => {
|
||||
invoke("save_json", { jsonContent: pokemonDataArray})
|
||||
.then(() => {})
|
||||
.catch((err) => console.log(err));
|
||||
}}
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<button
|
||||
on:click={() => {
|
||||
invoke("load_json").then((d) => {
|
||||
pokemonDataArray = d;
|
||||
pokemonData = pokemonDataArray[index];
|
||||
})
|
||||
.catch((e) => console.log(e));
|
||||
}}
|
||||
>
|
||||
Load
|
||||
</button><br />
|
||||
<button
|
||||
on:click={() => {
|
||||
pokemonData = undefined;
|
||||
pokemonDataArray = [];
|
||||
index = 0;
|
||||
myValue = undefined;
|
||||
}}>Clear</button
|
||||
}}
|
||||
>
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="display-data">
|
||||
|
||||
Reference in New Issue
Block a user