29 lines
787 B
Text
29 lines
787 B
Text
|
|
-- Multi-Action Click Handler Test
|
|||
|
|
-- Tests semicolon-separated actions in click handlers
|
|||
|
|
|
|||
|
|
let items = ["Buy milk", "Walk dog"]
|
|||
|
|
let input = ""
|
|||
|
|
let count = 0
|
|||
|
|
|
|||
|
|
view main = column [
|
|||
|
|
text "Multi-Action Demo" { variant: "title" }
|
|||
|
|
text "Add items AND clear input in one click" { variant: "subtitle" }
|
|||
|
|
|
|||
|
|
row [
|
|||
|
|
input { bind: input, placeholder: "New item..." }
|
|||
|
|
button "Add & Clear" { click: items.push(input); input = "", variant: "primary" }
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
each item in items ->
|
|||
|
|
row [
|
|||
|
|
text "• {item}"
|
|||
|
|
button "×" { click: items.remove(_idx), variant: "ghost" }
|
|||
|
|
]
|
|||
|
|
|
|||
|
|
text "Count: {count}"
|
|||
|
|
row [
|
|||
|
|
button "+5 & Reset Name" { click: count += 5; input = "reset!", variant: "secondary" }
|
|||
|
|
button "Reset All" { click: count = 0; items = [], variant: "ghost" }
|
|||
|
|
]
|
|||
|
|
]
|