Slide 1

Slide 1 text

„Nice to met Vue“ Vue.js 2 Overview, Basics, Learnings

Slide 2

Slide 2 text

Ben Richter Frontend Developer @move:elevator

Slide 3

Slide 3 text

General Angular / React / Vue

Slide 4

Slide 4 text

Overview Release 2013 by Evan You (formerly Meteor and Google)
 Open Source Single-Page-Webapps, MVVM
 Simplicity, Performance, Singlefile Components Popularity: 83K Github stars (React 88K)
 Enterprise: Gitlab, Alibaba (china google), nintendo https://vuejs.org/v2/guide/comparison.html Eco-system

Slide 5

Slide 5 text

Cherry Picker Angular: HTML Templating engine with Directives 
 —> easier migration of existing Code
 Typescript-Support React: Virtual DOM, Props, Redux-like store & routing 
 Scoped CSS, CLI generator (multiple templates) Polymer / Riot: Singlepage components Coherent eco-system: vue-router, Vuex
 Low learning curve. Intuitive. Fun!
 https://www.quora.com/Should-I-learn-React-js-or-Vue-js-Is-it-worth-it-if-I-learn-Vue-js-first-and-then-React- js/answer/Andy-Merskin?share=c40c234d&srid=TrWC The Best of all worlds

Slide 6

Slide 6 text

Basics Startup, Templating, Structure, Plugins

Slide 7

Slide 7 text

Starting a project IE8 and up with babel-polyfill CLI generator npm install -g vue-cli vue init webpack todo-app CDN in production 
 https://scotch.io/tutorials/build-a-to-do-app-with-vue-js-2

Slide 8

Slide 8 text

Mustache interpolation {{ value }} Message: {{ msg }} Conditional rendering v-if, v-else, v-if-else

Now you see me

Visibility v-show

Hello!

List loops v-for
  • {{ index }} - {{ item.message }}
Templating https://vuejs.org/v2/guide/syntax.html#Directives

Slide 9

Slide 9 text

Dynamic property binding v-bind / :
:class="todo.done ? 'green' : 'red'" Two-way data binding v-model Event listener v-on / @ ... ... Directives https://vuejs.org/v2/guide/syntax.html#Directives

Slide 10

Slide 10 text

Data, Methods, Computed, Watch data() function! else shared 
 between instances props: methods: computed: watch: generic observer, good for heavy async computation https://vuejs.org/v2/guide/computed.html data() { return { todos: [‘string‘], } }, // Like methods, but are cached until dependency changes computed: { counterDone () { return this.todos.filter(todo => todo.done).length }, },

Slide 11

Slide 11 text

Lifecycle Hooks Lifecycle created mounted updated destroyed (+ beforeCreate, … ) https://vuejs.org/v2/guide/instance.html#Lifecycle-Diagram // no arrow functions! needs this context to vue instance created: function () { console.log('a is: ' + this.isCreating) },

Slide 12

Slide 12 text

Quasi standard Plugins Vuex State management Vue-router (Vue-resource HTTP-client —> Axios) Vue-test-utils Unit testing (+ Jest, Mocha, tape, AVA) Documentation DevTools: Components & Vuex (Chrome & Firefox) Server-Side Rendering Cross-Plattform: Weex, NativeScript-Vue More goodies

Slide 13

Slide 13 text

Let’s have a look Router, Vuex, Semantic-UI, Parcel-Bundler VueDo https://github.com/BenRichter/vue-todo

Slide 14

Slide 14 text

Learnings

Slide 15

Slide 15 text

Learnings Low learning curve, full speed in few weeks Very good Material Design implementation: vuetifyjs.com Always refactoring: first KISS then DRY
 (When separate components? Use data / props / store?)

Slide 16

Slide 16 text

Styleguide Components, prefix —> prevent Namespace errors prefix single-instance: TheHeader prefix with parent/coupled name: TodoList, TodoListButton data () {} must be a function, else shared between instances Specific props: https://vuejs.org/v2/style-guide/ status: { type: String, required: true, validator: function (value) { return ['syncing', 'error'].indexOf(value) !== -1 }, },

Slide 17

Slide 17 text

move:elevator JavaScript, PHP, Typo3, Projectmanager … Neustadt —> Food Modern light office Terrace Kicker table Coffee Club Mate

Slide 18

Slide 18 text

Vue ist FUN