-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.go
47 lines (38 loc) · 801 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
. "github.com/golazy/golazy/lazyview/html"
"github.com/golazy/golazy/lazyview/serve"
)
func main() {
DefineComponent(
Use("https://unpkg.com/@hotwired/stimulus@3.0.1/dist/stimulus.js"),
Script(`
// hello_controller.js
import { Controller } from "stimulus"
export default class extends Controller {
static targets = [ "name", "output" ]
greet() {
this.outputTarget.textContent =
`+"`Hello, ${this.nameTarget.value}!`"+`
}
}
`),
Raw(`<div data-controller="hello">
<input data-hello-target="name" type="text">
<button data-action="click->hello#greet">
Greet
</button>
<span data-hello-target="output">
</span>
</div>`),
)
serve.ServePage(Html(
Head(
Title("hola"),
),
Body(
H1("hola"),
),
),
)
}