fix: input-password input-search no work
parent
5178480d13
commit
536887a7a7
|
@ -5,9 +5,7 @@ import inputProps from './inputProps';
|
|||
import { hasProp, getComponentFromProp } from '../_util/props-util';
|
||||
import { isIE, isIE9 } from '../_util/env';
|
||||
import { ConfigConsumerProps } from '../config-provider';
|
||||
import Password from './Password';
|
||||
import Icon from '../icon';
|
||||
import warning from '../_util/warning';
|
||||
|
||||
function noop() {}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import classNames from 'classnames';
|
||||
import { getComponentFromProp, getOptionProps } from '../_util/props-util';
|
||||
import Input from './Input';
|
||||
import Icon from '../icon';
|
||||
import inputProps from './inputProps';
|
||||
|
@ -57,19 +58,33 @@ export default {
|
|||
},
|
||||
},
|
||||
render() {
|
||||
const { prefixCls, inputPrefixCls, size, suffix, visibilityToggle, ...restProps } = this.$props;
|
||||
const { prefixCls, inputPrefixCls, size, suffix, visibilityToggle, ...restProps } = getOptionProps(this);
|
||||
const suffixIcon = visibilityToggle && this.getIcon();
|
||||
const inputClassName = classNames(prefixCls, {
|
||||
[`${prefixCls}-${size}`]: !!size,
|
||||
});
|
||||
const inputProps = {
|
||||
props: {
|
||||
...restProps,
|
||||
prefixCls: inputPrefixCls,
|
||||
size,
|
||||
suffix: suffixIcon,
|
||||
prefix: getComponentFromProp(this, 'prefix'),
|
||||
addonAfter: getComponentFromProp(this, 'addonAfter'),
|
||||
addonBefore: getComponentFromProp(this, 'addonBefore'),
|
||||
},
|
||||
attrs: {
|
||||
...this.$attrs,
|
||||
type: this.visible ? 'text' : 'password',
|
||||
},
|
||||
class: inputClassName,
|
||||
on: {
|
||||
...this.$listeners,
|
||||
},
|
||||
};
|
||||
return (
|
||||
<Input
|
||||
{...restProps}
|
||||
type={this.visible ? 'text' : 'password'}
|
||||
size={size}
|
||||
class={inputClassName}
|
||||
prefixCls={inputPrefixCls}
|
||||
suffix={suffixIcon}
|
||||
{...inputProps}
|
||||
/>
|
||||
);
|
||||
},
|
|
@ -127,6 +127,7 @@ export default {
|
|||
prefixCls: inputPrefixCls,
|
||||
size,
|
||||
suffix: this.renderSuffix(prefixCls),
|
||||
prefix: getComponentFromProp(this, 'prefix'),
|
||||
addonAfter: this.renderAddonAfter(prefixCls),
|
||||
addonBefore,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue