import { Component, OnInit } from '@angular/core';
import { NavController } from '@ionic/angular';
import { Router } from '@angular/router';

@Component({
  selector: 'app-message',
  templateUrl: './message.page.html',
  styleUrls: ['./message.page.scss'],
})
export class MessagePage implements OnInit {

  messages: any[] = [
    { title: '重要通知', timestamp: new Date(), sender: '系统管理员', content: '这是一条重要通知内容。' },
    { title: '新消息', timestamp: new Date(), sender: '小明', content: '你好，有空聊聊吗？' }
  ];


  ngOnInit() {
  }
  constructor(private navCtrl:NavController,private router: Router) {  
   }

   deleteMessage(message: any) {
    const index = this.messages.indexOf(message);
    if (index > -1) {
      this.messages.splice(index, 1);
    }
    
  }
  back(){
    this.navCtrl.back()
  }
  seeMessage(){
    this.router.navigate(['/chatter']);
  }
}
