问 题
ref={self => this.form = self}
this.form.onsubmit()
这样为什么报this.form.onsubmit is not a function
搜索组件
componentWillReceiveProps(nextProps) {
if ('click' in nextProps.receive) {
if (nextProps.receive.click) {
this.form.submit();
}
}
}
render (
ref={self => this.form = self}
onSubmit={() => this.handleSubmit(event)}
>
input...
)
Header组件
} />
transfer={data => this.transferSearch(data)}
receive={this.state.receiveSearch}
request={{
method: 'POST',
source: 'http://xxx:8080/bridge/prod_search',
key: ['prod_name', 'start', 'end']
}}
/>
this.transferHeaderRight(data)} />
简单说就是搜索按钮在form外面怎么触发onSubmit或者handleSubmit()
解决方案
因为没有onsubmit这个函数。
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注与百万开发者在一起