File

src/components/post-item/post-item.tsx

Metadata

tag post-item

Index

Properties
Methods

Methods

clickedDetail
clickedDetail(post)
Parameters :
Name Optional
post No
Returns : void
componentDidLoad
componentDidLoad()
Returns : void
render
render()
Returns : any

Properties

el
el: Element
Type : Element
Decorators :
@Element()
post
post: any
Type : any
Decorators :
@Prop()
import { Component, Element, Prop } from '@stencil/core';


@Component({
  tag: 'post-item'
})
export class PostItem {

  @Prop() post: any;

  @Element() el: Element;

  componentDidLoad() {
    console.log(this.post);
  }

  clickedDetail(post) {
    (this.el.closest('ion-nav')as HTMLIonNavElement).push('post-detail', {post});
  }

  render() {
    return (
      <ion-item onClick={() => {this.clickedDetail(this.post)}}>
        <ion-avatar slot='start'>
          <post-img src={this.post.image} alt='feed image'></post-img>
        </ion-avatar>

        <ion-label>
          <h2>{this.post.title}</h2>
          <p>{this.post.postText}</p>

          <am-rating colorOn='#FFEB3B' rating={this.post.rating} max-rating='5'></am-rating>
        </ion-label>
      </ion-item>
    );
  }
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""