123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { Component, OnInit } from '@angular/core';
- import { IonButton, IonCard, IonCardHeader, IonCardSubtitle, IonCardTitle, IonContent, IonHeader, IonIcon, IonInput, IonItem, IonList, IonTitle, IonToolbar } from '@ionic/angular/standalone';
- import { IonCardContent,IonLabel } from '@ionic/angular/standalone';
- import { FormsModule } from '@angular/forms';
- import { CommonModule } from '@angular/common';
- @Component({
- selector: 'app-community',
- templateUrl: './community.page.html',
- styleUrls: ['./community.page.scss'],
- standalone: true,
- imports: [IonHeader,IonToolbar,IonTitle,IonContent,IonList,IonCard,IonCardHeader,
- IonCardTitle,IonCardSubtitle,IonItem,IonInput,IonButton,IonIcon,IonCardContent,
- FormsModule,CommonModule,IonLabel
- ],
- })
- export class CommunityPage implements OnInit {
- comments: { username: string; date: Date; text: string }[] = [];
- newComment: string = '';
- constructor() {
- this.comments = [
- { username: '用户1', date: new Date(), text: '这件衣服真好看!' },
- { username: '用户2', date: new Date(), text: '我也想要一件!' },
- ];
- }
- addComment() {
- if (this.newComment.trim()) {
- const newCommentObj = {
- username: '当前用户',
- date: new Date(),
- text: this.newComment,
- };
- this.comments.push(newCommentObj);
- this.newComment = '';
- }
- }
- ngOnInit() {
-
-
- }
- }
|