import {FormInput} from "../controller.js";

/**
 * 隐藏域组件
 * @param {[type]} dataModel [description]
 */
export default class Hidden extends FormInput {

  constructor(__tfp, dataModel, parent) {
    super(__tfp, "Hidden", dataModel, parent);
  }

  //属性
  get value() { return this.dataModel.value }
  set value(value) {
    this.dataModel.value = value;
    if(this._jqObj) {
      this._jqObj.val(value);
      this.exeEventHandler("onChange");
    }
  }

  initRuntime() {
    let that = this;
    this._jqObj.change(function() {
      that.dataModel.value = that._jqObj.val();
    });
  }
}