src/components/post-item/post-item.tsx
tag | post-item |
Properties |
Methods |
clickedDetail | ||||
clickedDetail(post)
|
||||
Defined in src/components/post-item/post-item.tsx:17
|
||||
Parameters :
Returns :
void
|
componentDidLoad |
componentDidLoad()
|
Defined in src/components/post-item/post-item.tsx:13
|
Returns :
void
|
render |
render()
|
Defined in src/components/post-item/post-item.tsx:21
|
Returns :
any
|
el |
el:
|
Type : Element
|
Decorators :
@Element()
|
Defined in src/components/post-item/post-item.tsx:11
|
post |
post:
|
Type : any
|
Decorators :
@Prop()
|
Defined in src/components/post-item/post-item.tsx:9
|
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>
);
}
}