Create app.jl
Browse files
app.jl
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
module App
|
2 |
+
using Stipple
|
3 |
+
|
4 |
+
@reactive mutable struct Name <: ReactiveModel
|
5 |
+
name::R{String} = "World"
|
6 |
+
end
|
7 |
+
|
8 |
+
function ui(model)
|
9 |
+
page( model, class="container", [
|
10 |
+
h1([
|
11 |
+
"Hello "
|
12 |
+
span("", @text(:name))
|
13 |
+
" from Genie.jl!"
|
14 |
+
])
|
15 |
+
|
16 |
+
p([
|
17 |
+
"What is your name? "
|
18 |
+
input("", placeholder="Type your name", @bind(:name))
|
19 |
+
])
|
20 |
+
]
|
21 |
+
)
|
22 |
+
end
|
23 |
+
|
24 |
+
route("/") do
|
25 |
+
model = Name |> init
|
26 |
+
html(ui(model), context = @__MODULE__)
|
27 |
+
end
|
28 |
+
|
29 |
+
end
|
30 |
+
#up() # or `up(open_browser = true)` to automatically open a browser window/tab when launching the app
|