0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-20 22:12:38 -05:00
astro/examples/framework-multiple/src/components/LitCounter.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
482 B
JavaScript
Raw Normal View History

2022-02-14 22:08:04 +06:00
import { LitElement, html } from 'lit';
export const tagName = 'my-counter';
class Counter extends LitElement {
static get properties() {
return {
count: {
type: Number,
},
};
}
constructor() {
super();
this.count = 0;
}
increment() {
this.count++;
}
render() {
return html`
<div>
<p>Count: ${this.count}</p>
<button type="button" @click=${this.increment}>Increment</button>
</div>
`;
}
}
customElements.define(tagName, Counter);