counter example
This commit is contained in:
parent
9cc7959609
commit
f8aac1420f
2 changed files with 2 additions and 2 deletions
|
@ -3,12 +3,10 @@ import WebComponent from "../src/WebComponent.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>`;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
<script type="module" src="HelloWorld.mjs"></script>
|
||||
<script type="module" src="SimpleText.mjs"></script>
|
||||
<script type="module" src="BooleanPropTest.mjs"></script>
|
||||
<script type="module" src="Counter.mjs"></script>
|
||||
</head>
|
||||
<body>
|
||||
<hello-world emotion="sad"></hello-world>
|
||||
<my-counter></my-counter>
|
||||
<p>
|
||||
<simple-text></simple-text>
|
||||
</p>
|
||||
|
|
Loading…
Reference in a new issue