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 {
|
export class Counter extends WebComponent {
|
||||||
static properties = ["count"];
|
static properties = ["count"];
|
||||||
|
|
||||||
onInit() {
|
onInit() {
|
||||||
this.props.count = 0;
|
this.props.count = 0;
|
||||||
this.onclick = () => ++this.props.count;
|
this.onclick = () => ++this.props.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
get template() {
|
get template() {
|
||||||
return `<button id="btn">${this.props.count}</button>`;
|
return `<button id="btn">${this.props.count}</button>`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
<script type="module" src="HelloWorld.mjs"></script>
|
<script type="module" src="HelloWorld.mjs"></script>
|
||||||
<script type="module" src="SimpleText.mjs"></script>
|
<script type="module" src="SimpleText.mjs"></script>
|
||||||
<script type="module" src="BooleanPropTest.mjs"></script>
|
<script type="module" src="BooleanPropTest.mjs"></script>
|
||||||
|
<script type="module" src="Counter.mjs"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<hello-world emotion="sad"></hello-world>
|
<hello-world emotion="sad"></hello-world>
|
||||||
|
<my-counter></my-counter>
|
||||||
<p>
|
<p>
|
||||||
<simple-text></simple-text>
|
<simple-text></simple-text>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue