which life cycle method is called during page refresh(shift+F5) in vuejs?

一笑奈何 提交于 2020-04-30 12:07:52

问题


When refresh my page, it is losing data. In my page i do a GET call in

  beforeMount(){
      this.getUserProfile()
    }, 

and when i am refreshing the page, the user profile data are lost. So which life cycle method is called during page refresh?? or during page refresh where i have to call getProfile() method?

getUserProfile:

 getUserProfile() {
    let flag = 1;

  axios
    .get("/api/user")
    .then(response => {
        let data = response.data;

       if (flag == 1) {

          this.fname = data.user.first_name;
          this.lname = data.user.last_name;
          this.email =  data.user.email;

        }else {
            Vue.$toast.error(data.message, {
            position: 'top-right'
            });
        }
     // })
      // .catch(err => {
      //   Vue.$toast.error(err, {
      //   position: 'top-right'
      //   });

       });

 },

来源:https://stackoverflow.com/questions/61436830/which-life-cycle-method-is-called-during-page-refreshshiftf5-in-vuejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!