Vue 2.0 Hello World

by zoomieos

HTML

<script src="https://unpkg.com/vue"></script>

<div id="app">
  <input type='text' v-model="text">

  <button @click.prvent="setAlert" type='send'>
  Send
  </button>
  <ul>
  <li v-for="n of person">{{n.name}}</li>
  </ul>
</div>

JavaScript

new Vue({
  el: '#app',
  data: {
    text: '123123',
    person: [
    	{
      	name: 'igor',
        links: '/first'
      },
      {
      	name: 'Petya',
        links: '/second'
      },  
    ]
  },
  methods: {
  		setAlert() {
      	this.person.push({name: this.text});
        this.text = ''
      }
  },
})