radh-ui
Version:
Stencil Component Starter
40 lines (39 loc) • 1.25 kB
JavaScript
import { Component, Element, h, Host, Listen, State } from "@stencil/core";
export class IndexPage {
constructor() {
this.tomaPaga = async () => {
const child = this.element.shadowRoot.querySelector('cjs-child');
await child.setPaga(5);
};
}
onReply(ev) {
this.messageFromChild = ev.detail;
}
render() {
return (h(Host, null,
h("cjs-child", { messageFromFather: "I am your father" }),
h("p", null,
"Message from child: ",
this.messageFromChild),
h("button", { onClick: this.tomaPaga }, "Toma paga")));
}
static get is() { return "index-page"; }
static get encapsulation() { return "shadow"; }
static get originalStyleUrls() { return {
"$": ["index-page.css"]
}; }
static get styleUrls() { return {
"$": ["index-page.css"]
}; }
static get states() { return {
"messageFromChild": {}
}; }
static get elementRef() { return "element"; }
static get listeners() { return [{
"name": "reply",
"method": "onReply",
"target": undefined,
"capture": false,
"passive": false
}]; }
}