Which VueJS lifecycle hook must Asynchronous HTTP requests be called in?
问题 I'd like to know how before I render a page, I want to send an async GET request to my server to retrieve data and populate the properties in data. I heard the best way to do this is to call the function that sends this request in one of the three lifecycle hooks Vue js offers that operate before the DOM is rendered. The three are beforeCreate() , created() , beforeMount() . Which one must this request be called in ideally? And why? 回答1: Vue's initialization code is executed synchronously.