24 lines
479 B
Rust
24 lines
479 B
Rust
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 {
|
|
|
|
}
|
|
}
|