This commit is contained in:
Dmitry Borisenko
2021-12-26 23:29:59 +01:00
parent e6e20add82
commit f54e95c254
3 changed files with 26 additions and 1 deletions

View File

@@ -10,7 +10,8 @@
import Toggle from "./widgets/Toggle.svelte";
import Anydata from "./widgets/Anydata.svelte";
//import Modal from "svelte-simple-modal";
import Content from "./Content.svelte";
import Modal from "svelte-simple-modal";
import Chart from "svelte-frappe-charts";
@@ -705,6 +706,9 @@
<Route path="/about">
<Card title={"Пример графика"}>
<Chart data={datachart} type="line" />
<Modal>
<Content />
</Modal>
</Card>
</Route>
</div>

13
src/Content.svelte Normal file
View File

@@ -0,0 +1,13 @@
<!-- Content.svelte -->
<script>
import { getContext } from "svelte";
import Surprise from "./Surprise.svelte";
const { open } = getContext("simple-modal");
const showSurprise = () => {
open(Surprise, { message: "It's a modal!" });
};
</script>
<p><button on:click={showSurprise}>Show me a surprise!</button></p>

8
src/Surprise.svelte Normal file
View File

@@ -0,0 +1,8 @@
<!-- Surprise.svelte -->
<script>
export let message;
</script>
<p>
🎉 {message} 🍾
</p>