Skip to content

Commit

Permalink
fix(taro-compontens): 修复 Textarea onInput 问题,对齐maxLength 属性值
Browse files Browse the repository at this point in the history
  • Loading branch information
jinjinjin0731 committed Nov 15, 2018
1 parent a24949d commit 1d75d47
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/taro-components/src/components/textarea/index.js
Expand Up @@ -6,22 +6,26 @@ class Textarea extends Nerv.Component {
}

onChange (e) {
const { onChange } = this.props
const { onChange, onInput } = this.props
Object.defineProperty(e, 'detail', {
enumerable: true,
value: {
value: e.target.value
}
})
onChange && onChange(e)
if (onChange) {
onChange && onChange(e)
} else {
onInput && onInput(e)
}
}

render () {
const {
className = '',
placeholder = '',
disabled,
maxlength = 140,
maxLength = 140,
onChange,
onFocus,
onBlur,
Expand All @@ -42,7 +46,7 @@ class Textarea extends Nerv.Component {
className={className}
placeholder={placeholder}
disabled={disabled}
maxlength={maxlength}
maxlength={maxLength}
autofocus={autoFocus}
onChange={onChange}
onFocus={onFocus}
Expand Down

0 comments on commit 1d75d47

Please sign in to comment.