Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Learn how to set up a basic Vue application.
Terminology
Vue instance
The root of a Vue application, created by using the new keyword. You pass the Vue instance an object containing options that give you the ability to store data and define methods (more about methods in a later video!). The data and methods you define are then used in a Vue template to control the behavior of your application.
Templating
A Vue template generally consists of HTML, data bindings and Vue directives (more about Vue directives in a later video!). This is where you lay out the rules of how Vue should display your data. In our example, we've built a template that creates two data bindings: a title and a message.
Data Binding
Data binding generally means establishing a connection between an application's data and the application's user interface. In the video we created a connection between the title and message data properties to the Vue template. Vue will make sure that this data is always in sync with the user interface. If title or message change, Vue will detect the the change and updates the browser without any extra legwork from us.
Basic Syntax of a Vue instance
new Vue({
el: '#anHTMLElement',
data: {
property1: "My Property!",
property2: 343,
property3: "This is the third property on my data object!"
}
});
Basic Syntax of a Vue template
<div id="anHTMLElement">
<h1>{{ property1 }}</h1>
<h2>{{ property2 }}</h2>
<p> {{ property3 }} </p>
</div>
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up