=== Create a Vue App ===
* create a constant which contains the app or apps
* Pass in the **options object** which contains all the elements of the app (e.g. data)
* Add a data function which contains what you will manage in the app
* data items are properties of the app and return objects
* don't forget **dbl curly brackets** are need in the html to reference the data properties or run valid javascript e.g. {{ name }}
In standard JS:
const app = Vue.createApp({
data: function() {
return {
name: 'Justin'
}
}
})
In ES6 (use arrow functions)
const app = Vue.createApp({
data() {
return {
name: 'Justin'
}
}
});
* Once created, in your html : mount the app from your Vue file
* The object doing the mounting is the name from the js file
* The #id is the id of the DOM component that you wish to connect the app element to