wcb/examples/props-blueprint/index.js
2023-12-08 18:00:40 +01:00

15 lines
330 B
JavaScript

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