import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { AppEnvironment } from 'src/environments/AppEnvironment';

@Component({
  selector: 'app-levelslide-list',
  templateUrl: './app-levelslide-list.component.html',
  styleUrls: ['./app-levelslide-list.component.scss'],
})
export class AppLevelslideList implements OnInit {

  @Input() height:string ="130pt";
  
  /**
   * 输入标题
   */
  @Input() title:String;

  /**
  * 基础路径
  */
  url: String = AppEnvironment.BaseUrl + AppEnvironment.ExportFile + "/";

  public _messages:Array<any> =[];

  /**
   * 输入属性
   */
  @Input() set messages(val:any){
    if(val){
      this._messages = JSON.parse(JSON.stringify(val));
      if(this._messages.length >0){
        this._messages.forEach((item:any) =>{
          if(item.image){
            item.image = JSON.parse(item.image);
          }
        })
      }
    }
  }

  /**
* 抛出数据
*/
  @Output() itemClick: EventEmitter<any> = new EventEmitter<any>();

  constructor() { }

  ngOnInit() { }


  public handleClick(item: any) {
    this.itemClick.emit(item);
  }
}
