enterprise/enterprise-old/todomvc/components/mod.rs

25 lines
479 B
Rust
Raw Normal View History

2020-01-11 07:25:45 +00:00
component! {
use enterprise::event::ClickEvent;
use enterprise::components::Button;
component Counter {
constructor() {
count: u32 = 0u32,
}
view {
<Button on:click={handleClick}>
Clicked {count} {if count == 1 { "time" } else { "times" }}
</Button>
}
fn handleClick(&mut self, _: ClickEvent) {
self.count += 1;
}
}
component Other {
}
}