问题
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