ayo.run-mcfly/src/components/my-hello-world.js
2025-08-16 23:24:56 +02:00

23 lines
442 B
JavaScript

/**
* Custom element using a minimal base class
* @see https://WebComponent.io
*/
class MyHelloWorld extends WebComponent {
static props = {
myName: 'World',
count: 0,
}
updateLabel() {
this.props.myName = `Clicked ${++this.props.count}x`
}
get template() {
return html` <button
onClick=${() => this.updateLabel()}
style="cursor:pointer"
>
Hello ${this.props.myName}!
</button>`
}
}