wcb/examples/demo/Counter.mjs
2023-12-08 18:00:40 +01:00

15 lines
361 B
JavaScript

// @ts-check
import { WebComponent } from "../../src/index.js"
export class Counter extends WebComponent {
static properties = ["count"];
onInit() {
this.props.count = 0;
this.onclick = () => ++this.props.count;
}
get template() {
return `<button id="btn">${this.props.count}</button>`;
}
}
customElements.define("my-counter", Counter);