2-Way Data Binding in VueJs
A simple demo of 2-way data binding in VueJs - http://coligo.io
by superj80820
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<div id="vue-instance">
<!-- this will be the DOM element we will mount our VueJs instance to -->
Enter a greeting:
<input type="text" v-model="greeting">
<pre>{{ $data | json }}</pre>
{{greeting}}
{{a}}
</div>
JavaScript
var vm = new Vue({
el: '#vue-instance',
data: function () {
return {
greeting: 'Hello VueJs!',
a: (() => {
console.log(this)
console.log(this.greeting)
return this.greeting
})()
}
}
});