Intro to Vue.js
What is Vue.js?
● Framework for building user interfaces
● Focused on the view layer
● Easily integrate with other libraries
● Current version: 2.4.1
Key features
● Simple(low barrier of entry)
● Lightweight (~24kb min+gzip)
● Fast
● Reactive
● Component based
History
Creator:
Evan You - ex employee of Google,
and Meteor Dev Group
First commit: Jul 2013
First release: Feb 2014
Discovered by Laravel Apr 2015
Release of
second(current) version:
Sep 2016
Ghost in the Shell Evangelion
How it relates to Vue.js?
Company which use
2016 JavaScript Frameworks Rising Stars
Others Benchmarks
Vue can also!
React
Components
JSX
Fast
Flexible architecture
Testable components
Angular
Components
First-class TypeScript support
Full offering - officially supported router
and state management, among others
Installing
● CDN
● NPM
● Bower
● CLI
Ecosystem
Ajax github.com/vuejs/vue-resource || github.com/mzabriskie/axios
Routing github.com/vuejs/vue-router
Flux-like State github.com/vuejs/vuex
CLI Generator github.com/vuejs/vue-cli
Linting github.com/vuejs/vue-validator
... ...
Devtools(chrome extension/firefox addon)
Basics
https://codepen.io/Graniron/pen/JJzwEB?editors=1010
Directives
● v-text
● v-html
● v-show
● v-if
● v-else
● v-else-if
● v-for
● v-on
● v-bind
● v-model
● v-pre
● v-cloak
● v-once
https://vuejs.org/v2/api/#Directives
v-if
https://codepen.io/Graniron/pen/jwjygR?editors=1010
v-for
https://codepen.io/Graniron/pen/pwXebo?editors=1010
v-model
https://codepen.io/Graniron/pen/BZgWvX?editors=1010
v-bind/v-on
https://codepen.io/Graniron/pen/vZqxgj?editors=1010
Event modifiers
● .stop
● .prevent
● .capture
● .self
● .once
https://vuejs.org/v2/guide/events.html#Event-Modifiers
Keys modifiers
● .enter
● .tab
● .delete (captures
both “Delete” and
“Backspace” keys)
● .esc
● .space
● .up
● .down
● .left
● .right
● .ctrl
● .alt
● .shift
● .meta
Mouse modifiers
● .left
● .right
● .middle
https://vuejs.org/v2/guide/events.html#Modifier-Keys
Vue instance properties
https://vuejs.org/v2/api/#Options-Data
Lifecycle hooks
Example of using hooks
https://vuejs.org/v2/api/#Options-Lifecycle-Hooks
Components
Components communication
Component communication example
Fast start with CLI
● $ npm install -g vue-cli
● $ vue init <template-name> <project-name>
Single file component
What About Separation of Concerns?
Declare components locally
Filters
There are a lot more in Vue
● custom directives,
● mixins,
● slots,
● events bus,
● animation,
● dynamic components
● vue-router, router guards
● vue-resource, interceptors
● vuex
● server side rendering(nuxt.js)
● ...
Cons
● Relatively small community
● Is not backed by giant company
● Relatively small amount of resources
Resources
https://vuejs.org
https://github.com/vuejs/awesome-vue
https://github.com/vuejs/vue-cli
https://css-tricks.com/guides/vue/
https://www.udemy.com/vuejs-2-the-complete-guide/
https://github.com/vuejs/vue-router
https://github.com/vuejs/vuex
https://nuxtjs.org/
https://vuejs-tips.github.io/cheatsheet/
https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd
// Simple book CRUD made with Vue.js
https://github.com/Graniron/tm-vue-library
Contacts
graniron
roman.yavoriv@techmagic.co
graniron

Intro to vue.js