Basic VueJs Component

Defining and using a component - http://coligo.io

by Alexey Ryazhskikh

HTML

<script src="https://cdn.jsdelivr.net/vue/1.0.16/vue.js"></script>
<div id="app">
  <greeting></greeting>
  <br/>
  <input type="text" :value="text1"/> 
  {{text1}}
</div>

JavaScript

Vue.component('greeting', {
  props: ["text"],
  template: '<h1>Welcome to coligo!</h1>'
});

// create a new Vue instance and mount it to our div element above with the id of app
var vm = new Vue({
  el: '#app',
  data: function() {
     return {text1: ""};
  }
});