import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'

@Component({
  selector: 'app-page2',
  templateUrl: './page2.component.html',
  styleUrls: ['./page2.component.css']
})
export class Page2Component implements OnInit {
  @Input() curPageData: Array<any>
  @Output() getAllAnswer = new EventEmitter<any>()
  selectedNum:number;
  constructor() {}

  ngOnInit() {
    console.log(this.curPageData)
  }
  getAnswer(option) {
    const ret = {
      pageId: this.curPageData['pageId'],
      questions: [
        {
          questionId: this.curPageData['questions'][0].questionId,
          options: [option]
        }
      ]
    }
    this.getAllAnswer.emit(ret)
  }

  changeStyle(optionId){
    //当前选中项
    this.selectedNum = optionId
  }
}
