import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { IonicModule } from '@ionic/angular'; // 导入 IonicModule
@Component({
  selector: 'app-edit-tag',
  templateUrl: './edit-tag.component.html',
  styleUrls: ['./edit-tag.component.scss'],
  standalone: true,
  imports:[IonicModule]
})
export class EditTagComponent  implements OnInit {
  userInputText: string = '';
  onUserInput(event: any){
    console.log(event);
    this.userInputText = event.detail.value;
  }
tags: Array<string> = [];
  addTag(){
    this.tags.push(this.userInputText);
    this.userInputText = '';
    this.onTagChange.emit(this.tags);
  }
  deleteTag(tag:string){
    let idx=this.tags.findIndex(item=>item==tag);
    this.tags.splice(idx,1);
  }
@Output()
onTagChange:EventEmitter<Array<string>> = new EventEmitter<Array<string>>();


  constructor() { }

  ngOnInit() {}

}
