Skip to content

Lesson 1: Basic Data Binding

stackoverflows edited this page Nov 8, 2017 · 2 revisions

Need root div around all the content you want to interact with Vue

<body>
<div id = "root">
 // .. Rest of content

</div>
// .. usually JS imports go here
</body>

Then you need to define root Vue object:

var  app = new Vue({
    el: "#root",
    data: {
         desc = "Hello World"
    }
});

Next bind elements:

<input type = 'text' v-model = "desc" />

Or you can display the text in html:

<p>Our description: {{desc}} </p>

Clone this wiki locally