【发布时间】:2019-12-23 13:02:01
【问题描述】:
我像这样使用 history.push :
state = {
resumeList : [],
}
Searchinp = (event) => {
event.preventDefault()
const props = this.props
console.log(props)
const searchValue = event.target.value
this.setState({
Search:searchValue
})
console.log(searchValue)
props.history.push({search: `phrase=${searchValue}` });
reqhandler({
url: exporturl.getportofoliorequest(),
method : "get",
headers : {
"Authorization": `Bearer ${gettoken().acctoken}`
},
params : {
lang : getLang(),
phrase : event.target.search.value
}
}).then(res => {
console.log(res.data)
this.setState({
...this.state,
resumeList : res.data.results,
})
console.log(this.state.resumeList)
}).catch(err => {
console.log("Error :" , err)
})
}
当我使用 history.poush() 我的状态没有更新但 url 改变了。 但是当我删除它时,我的状态更新了 请帮帮我
【问题讨论】: