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

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


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

  @Input() public title:string;

  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() { }

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

}
