Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Get More Done with Vue.js Nodevember 2017

Jonathan Kemp
November 28, 2017

Get More Done with Vue.js Nodevember 2017

Vue.js is a framework for building user interfaces that’s designed to be simple and flexible with a heavy focus on performance. In this session, you’ll learn what Vue.js is and how its simplicity and flexibility combined with its performance and developer experience can help you get more done.

Jonathan Kemp

November 28, 2017
Tweet

More Decks by Jonathan Kemp

Other Decks in Technology

Transcript

  1. GET MORE DONE WITH VUE.JS • What is it? •

    Easy to get started • It’s flexible • Developer Tools
  2. TEMPLATES <div id="app"> Hello {{name}}! </div> var app = new

    Vue({ el: '#app', data: { name: 'Jonathan' } });
  3. TEMPLATES <div id="app"> Hello {{name}}! </div> var app = new

    Vue({ el: '#app', data: { name: 'Jonathan' } });
  4. DIRECTIVES <div id="app"> <ol> <li v-for="item in list"> {{ item

    }} </li> </ol> </div> var app = new Vue({ el: '#app', data: { list: ['One', 'Two', 'Three', 'Four'] } });
  5. DIRECTIVES <div id="app"> <ol> <li v-for="item in list"> {{ item

    }} </li> </ol> </div> var app = new Vue({ el: '#app', data: { list: ['One', 'Two', 'Three', 'Four'] } });
  6. EVENT LISTENERS <div id="app"> <h3>TODO List</h3> <form id="todo-form"> <input id="update"

    type="text" value="" /> <button type="submit" v-on:click.prevent="addTodo">Add Item</button> </form> <ol> <li v-for="item in list"> {{ item }} </li> </ol> </div>
  7. EVENT LISTENERS <div id="app"> <h3>TODO List</h3> <form id="todo-form"> <input id="update"

    type="text" value="" /> <button type="submit" v-on:click.prevent="addTodo">Add Item</button> </form> <ol> <li v-for="item in list"> {{ item }} </li> </ol> </div>
  8. EVENT LISTENERS var app = new Vue({ el: '#app', data:

    { list: [] }, methods: { addTodo: function () { var input = document.getElementById('update'); this.list = this.list.concat(input.value); } } });
  9. EVENT LISTENERS var app = new Vue({ el: '#app', data:

    { list: [] }, methods: { addTodo: function () { var input = document.getElementById('update'); this.list = this.list.concat(input.value); } } });
  10. COMPONENTS // Define a new component called todo-item Vue.component('todo-item', {

    template: '<li>This is a todo</li>' }) <ol> <!-- Create an instance of the todo-item component --> <todo-item></todo-item> </ol>
  11. COMPONENTS // Define a new component called todo-item Vue.component('todo-item', {

    template: '<li>This is a todo</li>' }) <ol> <!-- Create an instance of the todo-item component --> <todo-item></todo-item> </ol>
  12. VUE • Does not require a compiler • Anyone can

    start using it with ES5 • Official documentation written in ES5
  13. HELLO.VUE <template> <p>{{ greeting }} World!</p> </template> <script> module.exports =

    { data: function () { return { greeting: ‘Hello’ } } } </script> <style scoped> p { font-size: 2em; text-align: center; } </style>