vue mounted 1

vue mounted


Here is what the above code is Doing:
1. We’re importing the Vue library and the App component
2. We’re telling Vue to use the vue-resource library
3. We’re creating a Vue instance and telling it which element of the DOM to control, and which component to use.
4. We’re creating a data object with a property called ‘tasks’ and setting it to an empty array.
5. We’re creating a method called init() which will fetch the tasks from the API and store them in the tasks array.
6. We’re telling Vue to run the init() method when the app loads.

Similar Posts