【发布时间】:2019-12-23 06:46:08
【问题描述】:
我像这样使用 history.push 但我的响应没有显示在列表中,页面开始重新加载:
Searchinp = (event) => {
event.preventDefault()
const props = this.props
console.log(props)
const searchValue = event.target.search.value
props.history.push(`?phrase=${searchValue}`)
reqhandler({
url: exporturl.getportofoliorequest(),
method : "get",
headers : {
"Authorization": `Bearer ${gettoken().acctoken}`
},
params : {
lang : getLang(),
phrase : event.target.search.value
}
}).then(res => {
this.setState({
...this.state,
resumeList : res.data.results
})
console.log(res.data)
}).catch(err => {
console.log("Error :" , err)
})
}
请帮帮我。
【问题讨论】:
-
您能补充更多信息吗?比如你当前的 URL 是什么以及页面重新加载时它会变成什么
-
我在 localhost:3000/dashboard 中的当前 url 和成为 url 是 locolhost:3000/dashboard?phrase=somestring ,我用它来搜索输入请求