Created
September 17, 2017 09:26
-
-
Save vivainio/745399b7861af10aa7a3344842943c64 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, Prop, EventEmitter, Event } from "@stencil/core"; | |
| @Component({ | |
| tag: 'my-name', | |
| styleUrl: 'my-name.scss' | |
| }) | |
| export class MyName { | |
| @Prop() simplestring: string; | |
| @Prop() strings: string[]; | |
| @Event() onListClick: EventEmitter; | |
| listClick(e) { | |
| console.log('list item clicked in stencil'); | |
| this.onListClick.emit(e); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <p>Simple string is {this.simplestring}</p> | |
| { this.strings ? ( | |
| <ul> | |
| { this.strings.map(s => <li onClick={ e => this.listClick(e) }> | |
| {s} | |
| </li>) } | |
| </ul>) : <p onClick={_ => this.listClick(null) }>No strings yet</p>} | |
| <slot></slot> | |
| </div> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment