server side Karax rendering: show how events can be handled

This commit is contained in:
Andreas Rumpf 2019-03-14 11:21:49 +01:00
commit 20fe35355c

View file

@ -5,6 +5,10 @@ import "../karax" / [karaxdsl, vdom]
when defined(js): when defined(js):
{.error: "Use 'nim c' to compile this example".} {.error: "Use 'nim c' to compile this example".}
template kxi(): int = 0
template addEventHandler(n: VNode; k: EventKind; action: string; kxi: int) =
n.setAttr($k, action)
let tab = buildHtml(table): let tab = buildHtml(table):
tr: tr:
td: td:
@ -16,5 +20,8 @@ let tab = buildHtml(table):
text "Cell C" text "Cell C"
td: td:
text "Cell D" text "Cell D"
td:
a(href = "#/", onclick = "javascript:myFunc()"):
text"haha"
echo tab echo tab