feat: update input-number

pull/802/head
wangxueliang 2019-04-10 08:51:42 +08:00
parent 0566ae23e1
commit b14988d769
2 changed files with 14 additions and 7 deletions

View File

@ -3,6 +3,7 @@ import { initDefaultProps, getOptionProps } from '../_util/props-util';
import classNames from 'classnames';
import Icon from '../icon';
import VcInputNumber from '../vc-input-number/src';
import { ConfigConsumerProps } from '../config-provider';
export const InputNumberProps = {
prefixCls: PropTypes.string,
@ -31,9 +32,11 @@ const InputNumber = {
event: 'change',
},
props: initDefaultProps(InputNumberProps, {
prefixCls: 'ant-input-number',
step: 1,
}),
inject: {
configProvider: { default: () => ({}) },
},
methods: {
focus() {
this.$refs.inputNumberRef.focus();
@ -44,16 +47,20 @@ const InputNumber = {
},
render() {
const { size, ...others } = getOptionProps(this);
const { prefixCls: customizePrefixCls, size, ...others } = getOptionProps(this);
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
const inputNumberClass = classNames({
[`${this.prefixCls}-lg`]: size === 'large',
[`${this.prefixCls}-sm`]: size === 'small',
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
});
const upIcon = <Icon type="up" class={`${this.prefixCls}-handler-up-inner`} />;
const downIcon = <Icon type="down" class={`${this.prefixCls}-handler-down-inner`} />;
const upIcon = <Icon type="up" class={`${prefixCls}-handler-up-inner`} />;
const downIcon = <Icon type="down" class={`${prefixCls}-handler-down-inner`} />;
const vcInputNumberprops = {
props: {
prefixCls,
upHandler: upIcon,
downHandler: downIcon,
...others,

View File

@ -33,7 +33,7 @@ export default {
},
mixins: [BaseMixin],
methods: {
onChange(e) {
onChange() {
this.setState({
visible: !this.visible,
});