UNPKG

ukelli-ui

Version:

Base on React's UI lib. Make frontend's dev simpler and faster.

33 lines (32 loc) 1.51 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { UkeComponent } from '../utils/uke-component'; var FormControlBasic = /** @class */ (function (_super) { __extends(FormControlBasic, _super); function FormControlBasic(props) { var _this = _super.call(this, props) || this; _this.stateValueMark = 'selectedValue'; _this.getValue = function (stateValueMark) { if (stateValueMark === void 0) { stateValueMark = _this.stateValueMark; } return (_this.isControl ? _this.props.value : _this.state[stateValueMark]); }; var value = props.value, defaultValue = props.defaultValue; // 如果是多选模式,value, defaultValue 必须为array,否则value, defaultValue必须为string _this.isControl = props.hasOwnProperty('value'); _this.value = value || defaultValue; return _this; } return FormControlBasic; }(UkeComponent)); export default FormControlBasic;