Learn about initializing data, running code after mounting, etc.
- [Instructor] A view instance…exposes a number of lifecycle hooks…that we can use in order to execute custom code…in response to certain events…during initialization, updates, and destruction.…The beforeCreate hook is triggered…before the instance is initialized…and any data is processed.…The Created hook is called after…the properties are configured,…but before the instance has been mounted to the DOM.…The beforeMount hook is called…when the template is compiled,…and ready to be inserted into the DOM.…
The Mounted hook is called…when the template is inserted into the DOM…as a replacement for the el element.…Once the instance has been mounted,…the beforeUpdate hook will be triggered…whenever data changes.…And the Updated hook…will be run after re-rendering to reflect the changes.…Finally, the beforeDestroy and Destroyed events…are raised whenever vm.$destroy is called.…This involves removing watchers and event handlers,…and it's mainly useful when dealing with components,…which we'll talk more about later.…
Over here in this file called lifecycle.html…
In this course, Michael Sullivan introduces the Vue framework, explains which problems it aims to solve, and shows how to add Vue to a new or existing webpage. Michael examines a Vue instance and its lifecycle, and shows simple and advanced data binding techniques along with how to manage CSS related attributes dynamically and handle user input and events. After he covers the key concepts and basic conventions of Vue, Michael dives into its component system, which can help you create modular, reusable code, and shows how to use the vue-router plugin to set up a single-page application with client-side routing.
- Creating a Vue app
- Applying control logic
- Binding to the style attribute and class attribute
- Reviewing the features of a Vue instance
- Registering and using Vue components
- Installing vue-cli and webpack
- Understanding the Vue app skeleton