axios.post ("/ api/php/user/findPsw.json",params). Then ((res) = > {
) var jsonObj = JSON.stringify(res.data)
var jsonTemp="[{"
var checkPsw = jsonObj.substring(jsonObj.indexOf("password")+11,jsonObj.indexOf("roleIdList")-3).split("0").join("")
if(checkPsw===password){
this.setState({passwordCheck:true})
}
}).catch((err)=>{
alert(err.status)
console.log(err.status)
})
if(this.state.passwordCheck){ //
alert("")
//...
}
as in the above code, I check whether the checkPsw in the json is the same as the password extracted from the page in the response then method of the axios request, so that under the passwordCheck, of setState, it is judged that if it is true, I will log in to the page, but this passwordCheck value, due to the running order, always starts to judge that the login demo I wrote has to press two clicks to log in before the then method is executed before the setState is executed before it will jump. I would like to ask the gods, whether you can use the queue to execute the axios request block, so that the execution of the setState block is finished, and then to judge this.state.passwordCheck, on this issue, I react+antd just started to compare, the answer please code as simple as possible easy to understand. *
italic text
*