Module2 Flashcards
How do you create a Vue app?
You call the Vue.createApp() function with an Object Vue.createApp({});
How do you connect the Vue app to your HTML
You create the app and store it in a variable then you run the mount function on it with a selector for the area of the HTML you want to control. const app = Vue.createApp().mount('#app');
How do you define the data model of the Vue app?
you create a Data function (Data(){} - shorthand syntx) that returns an object with the data fields for the app
What is interpolation?
Interpolation is when you use {{ }} to show a value that is returned in the Data object of the vue app. This syntax only works between open and closed html tags, meaning only places that can display content.
What is computed?
computed is another section in the app that is made to keep functions that are used to return and display a computed value based on the fields in the data object. It is computed only if those fields change
What is v-bind
v-bind is a directive that binds an attribute to a value / function in the app. We need to use it since you cannot use interpolation where content is not expected like in the link for an href.
which directive is used to connect an attribute with a method or value in the app
The directive is v-bind it’s shorthand is :attributeName=”somethingFromConfg”
how do you recognize a vue directive
Vue directives all start with v-
what is methods
methods is a reserved word in vue for an object in the app configuration where we keep methods that we want to invoke from the html.
how do you manipulate fields from the data object returned by data inside the methods in the methods objects
you need to refer to the data fields using this.
how do you output raw html using vue
In order to output raw html in Vue you need to use the v-html directive.