| | |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | |
| | | let val = config.initval || '' |
| | | let val = config.initval || config.initVal || '' |
| | | let options = config.options || ['px', 'vh', 'vw', '%'] |
| | | let unit = options[0] |
| | | |
| | | if (val) { |
| | | if (val && typeof(val) === 'string') { |
| | | if (val.indexOf('px') > -1) { |
| | | unit = 'px' |
| | | } else if (val.indexOf('%') > -1) { |
| | |
| | | const { value, options, unit } = this.state |
| | | |
| | | return ( |
| | | <div className="style-input-wrap"> |
| | | <div className="mk-style-input-wrap"> |
| | | <Input value={value} addonAfter={ |
| | | options.length > 1 ? |
| | | <Select value={unit} onChange={this.changeUnit}> |