Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
207 views
in Technique[技术] by (71.8m points)

javascript - the disappearance of states when reloading the page

I am making a clothing store, I made the product presentation page. it works fine, but when i reload the page, state reverts to the initial state and returned to the console "y a rien pour le remplir". as the componentDidMount did not work. ---the image before reloadenter image description here

---the image after reload enter image description here

componentDidMount(){
       const {load_state} = this.props // You Need Thi
    let request = new FormData;
    request.append("getters_produit","true");
    Axios.post('http://localhost/e_commerce/src/php/get.php',request).then(function(reponce){
        //handle succes
            load_state(reponce.data.les_produit);
    }).catch(function(error){
        alert(error);
    }).then(function(){
        //always executed
    });
}

render(){
return (<div className="les_produit">
{(this.props.state.liste_produit == "none") ? console.log("y a rien pour le remplir") :this.romplir_page(this.props.state.liste_produit) }
</div>)}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...