ItemBean.ets 679 Bytes
import { ItemDTO } from './ItemDTO';
import { Action } from './programme/Action';
import { Pic } from './programme/Pic';

/**
 * 绑定到组件comp/view的数据Bean
 */
@Observed
export abstract class ItemBean {
  action?: Action; // 事件行为
  pics?: Pic
  /**
   * 是否被曝光
   */
  exposed: boolean;
  /**
   * 曝光位置
   */
  position: string;

  constructor(dto?: ItemDTO) {
    if (dto) {
      this.action = dto.action
      this.pics = dto.pics
    }
    this.exposed = false
    this.position = "0"
  }

  public setAction(action: Action): void {
    this.action = action
  }

  public getAction(): Action {
    return this.action ?? {} as Action
  }
}