39
Intro to Vue.js

Intro to vue.js

Embed Size (px)

Citation preview

Page 1: Intro to vue.js

Intro to Vue.js

Page 2: 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

Page 3: Intro to vue.js

Key features

● Simple(low barrier of entry)● Lightweight (~24kb min+gzip)● Fast● Reactive● Component based

Page 4: Intro to vue.js

History

Создателем Vue.js является Evan You, бывший сотрудник Google и Meteor Dev Group. Начал он разрабатывать фреймворк в 2013-м, а в феврале 2014-го

состоялся первый публичный релиз. Vue широко используется среди китайских компаний, например: Facebook, Alibaba, Baidu, Xiaomi, Sina Weibo, WizzAir, EuroNews, Grammarly, Gitlab и Laracasts и др. Он входит в ядро Laravel и

PageKit. Недавно свободная система управления репозиториями GitLab тоже перешла на Vue.js.

В конце сентября 2016-го вышел в релиз Vue.js 2.0, еще круче и с упором на производительность — теперь используется виртуальный DOM,

поддерживается серверный рендеринг, возможность использовать JSX и т.д.

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

Page 5: Intro to vue.js

Ghost in the Shell Evangelion

Page 6: Intro to vue.js

How it relates to Vue.js?

Page 7: Intro to vue.js

Company which use

Page 8: Intro to vue.js
Page 9: Intro to vue.js
Page 12: Intro to vue.js

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

Page 13: Intro to vue.js

Installing

● CDN● NPM● Bower● CLI

Page 16: Intro to vue.js

Basics

https://codepen.io/Graniron/pen/JJzwEB?editors=1010

Page 20: Intro to vue.js

v-model

https://codepen.io/Graniron/pen/BZgWvX?editors=1010

Page 21: Intro to vue.js

v-bind/v-on

https://codepen.io/Graniron/pen/vZqxgj?editors=1010

Page 22: Intro to vue.js

Event modifiers

● .stop● .prevent● .capture● .self● .once

https://vuejs.org/v2/guide/events.html#Event-Modifiers

Page 23: Intro to vue.js

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

Page 24: Intro to vue.js

Vue instance properties

https://vuejs.org/v2/api/#Options-Data

Page 25: Intro to vue.js

Lifecycle hooks

Page 26: Intro to vue.js

Example of using hooks

https://vuejs.org/v2/api/#Options-Lifecycle-Hooks

Page 27: Intro to vue.js

Components

Page 28: Intro to vue.js

Components communication

Page 29: Intro to vue.js

Component communication example

Page 30: Intro to vue.js

Fast start with CLI● $ npm install -g vue-cli● $ vue init <template-name> <project-name>

https://github.com/vuejs/vue-cli

Page 31: Intro to vue.js

Single file component

Page 32: Intro to vue.js

What About Separation of Concerns?

Page 33: Intro to vue.js

Declare components locally

Page 34: Intro to vue.js

Filters

Page 35: Intro to vue.js

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)● ...

Page 36: Intro to vue.js

Cons

● Relatively small community

● Is not backed by giant company

● Relatively small amount of resources

Page 38: Intro to vue.js
Page 39: Intro to vue.js

Contacts graniron

[email protected]

graniron