diff --git a/src/cascader/Cascader.jsx b/src/cascader/Cascader.jsx index b536f66d1..b180f25b8 100644 --- a/src/cascader/Cascader.jsx +++ b/src/cascader/Cascader.jsx @@ -162,6 +162,8 @@ class Cascader extends Component { } handlePick(value: [], close: boolean = true) { + const { form } = this.context; + this.setState({ currentValue: value }); @@ -173,6 +175,8 @@ class Cascader extends Component { if (this.props.onChange) { this.props.onChange(value); } + + form && form.onFieldChange(); } handleInputChange(value: any) { @@ -225,7 +229,7 @@ class Cascader extends Component { highlightKeyword(label: string, keyword: string): any { return label.split(keyword).map((node, index) => index === 0 ? node : [ - ({keyword}), + ({keyword}), node ]); } @@ -369,6 +373,10 @@ Cascader.childContextTypes = { component: PropTypes.any }; +Cascader.contextTypes = { + form: PropTypes.any +}; + Cascader.propTypes = { options: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string