import React, { Fragment, PureComponent } from 'react'; import { Input } from 'antd'; import styles from './PhoneView.less'; interface PhoneViewProps { value?: string; onChange?: (value: string) => void; } class PhoneView extends PureComponent { render() { const { value, onChange } = this.props; let values = ['', '']; if (value) { values = value.split('-'); } return ( { onChange && onChange(`${e.target.value}-${values[1]}`); }} /> { onChange && onChange(`${values[0]}-${e.target.value}`); }} value={values[1]} /> ); } } export default PhoneView;