【发布时间】:2018-11-20 20:52:28
【问题描述】:
Ant 设计有一个 HOC 包装器,用于实现如下形式:
class View extends Component {
render() {
return ( <FormItem
{...formItemLayout}
label='Country'>
{getFieldDecorator('country', {
initialValue: Company && Company.country,
})(
<Select
showSearch={true}
optionFilterProp="children"
filterOption={(input: any, option: any) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
placeholder="Select a Country"
onChange={this.handleSelectChange}
>
{countrylist}
</Select>
)}
</FormItem>)
}
}
export default compose(
Form.create()
...
)(View)
在普通的 javascript 中,this.handleSelectChange 工作正常,但我正在尝试将我的项目迁移到打字稿,我得到:
视图类型上不存在属性“handleSelectChange”
我尝试扩展界面,但我没有做对。我如何让它发挥作用?
【问题讨论】:
标签: javascript reactjs typescript antd