import { Component } from 'rax';

interface PropsData {
  componentData: any;
  // 在星环容器场景下会下发onChange方法来触发异步请求
  onChange?: Function;
  // 在星环容器场景下会下发onSubmit方法来触发提交请求
  onSubmit?: Function;
  fields: any;
  history: any;
}

interface StateData {
  time: number;
}


class MyComponent extends Component<PropsData, StateData> {
  public state: StateData = {
    time: 0,
  }

  public onClick() {
    console.log(this.props);
    this.setState((prev) => ({
      time: prev.time + 1,
    }));
  }

  public getData() {
    return {
      time: this.state.time,
    };
  }

  public getMethod() {
    return {
      onClick: this.onClick.bind(this),
    };
  }
};

export default MyComponent;
