SlideShare a Scribd company logo
Introduction to modern front-end
with Vue.js
Ivan Nikulin
Monterail Academy, Nov. 2017
Introduction to modern front-end with Vue.js
<html>
<head>
</head>
<body>
<h1>Hello world!</h1>
</body>
</html>
Hello world!
index.html
Introduction to modern front-end with Vue.js
Hello Vue world!
index.vue
<template>
<h1>Hello Vue world!</h1>
</template>
terminal
npm install -g vue-cli@2.8.0
vue build index.vue
Introduction to modern front-end with Vue.js
Hello Vue world!
index.vue
<template>
<h1>Hello Vue world!</h1>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
Introduction to modern front-end with Vue.js
Hello Vue.js world!
index.vue
<template>
<h1>Hello {{ title }} world!</h1>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
...
<script>
export default {
data () {
return {
title: 'Vue.js'
}
}
}
</script>
Hello Vue.js world!
index.vue
<template>
<h1>Hello {{ title }} world!</h1>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
...
<script>
export default {
data () {
return {
title: 'Vue.js'
}
}
}
</script>
Introduction to modern front-end with Vue.js
Hello wild world!
index.vue
<template>
<h1>Hello {{ title }} world!</h1>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
...
<script>
export default {
data () {
return {
title: 'wild'
}
}
}
</script>
Introduction to modern front-end with Vue.js
Hello maths world!
index.vue
<template>
<div>
<h1>Hello {{ title }} world!</h1>
<pre>{{ a }} + {{ b }} = {{ a + b }}</pre>
</div>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
...
<script>
export default {
data () {
return {
title: 'math',
a: 2,
b: 3
}
}
}
</script>
Introduction to modern front-end with Vue.js
Hello maths world!
index.vue
<template>
<div>
<h1>Hello {{ title }} world!</h1>
<pre :title="description">
{{ a }} + {{ b }} = {{ a + b }}
</pre>
</div>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #1a94da;
}
</style>
...
<script>
export default {
data () {
return {
title: 'math',
a: 2,
b: 3,
description: 'formula'
}
}
}
</script>
Introduction to modern front-end with Vue.js
HTML elements vs components
HTML elements vs components
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1>
Click below to become a Vue.js developer.
</h1>
<button>
Become a Vue.js developer
</button>
</div>
</template>
...
<style>
h1 {
font-family: "Helvetica";
color: #41b883;
}
</style>
Introduction to modern front-end with Vue.js
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1>
Congratulations, you’re a Vue.js developer!
</h1>
<h1>
Click below to become a Vue.js developer.
</h1>
<button>
Become a Vue.js developer
</button>
</div>
</template>
...
<style>
h1 {
font-family: "Helvetica";
color: #41b883;
}
</style>
Introduction to modern front-end with Vue.js
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1>
Congratulations, you are a Vue.js developer!
</h1>
<h1>
Click below to become a Vue.js developer.
</h1>
<button>
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
}
}
</script>
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1>
Click below to become a Vue.js developer.
</h1>
<button>
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
}
}
</script>
isVueDeveloper: false isVueDeveloper: true
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1 v-if="!isVueDeveloper">
Click below to become a Vue.js developer.
</h1>
<button>
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
}
}
</script>
isVueDeveloper: false isVueDeveloper: true
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1 v-if="!isVueDeveloper">
Click below to become a Vue.js developer.
</h1>
<button @click="isVueDeveloper = true">
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
}
}
</script>
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1 v-else>
Click below to become a Vue.js developer.
</h1>
<button @click="isVueDeveloper = true">
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
}
}
</script>
Let’s become a Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1 v-else>
Click below to become a Vue.js developer.
</h1>
<button @click="becomeVueDeveloper">
Become a Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
isVueDeveloper: false
}
},
methods: {
becomeVueDeveloper () {
this.isVueDeveloper = true
}
}
}
</script>
What is ES6 anyway?
ES6
<script>
export default {
data () {
return {
isVueDeveloper: false
}
},
methods: {
becomeVueDeveloper () {
this.isVueDeveloper = true
}
}
}
</script>
ES5
<script>
module.exports = {
data: function () {
return {
isVueDeveloper: false
}
},
methods: {
becomeVueDeveloper: function () {
this.isVueDeveloper = true
}
}
}
</script>
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1>
Click 5 times to become a better Vue.js developer.
</h1>
<button>
Become a better Vue.js developer
</button>
</div>
</template>
...
<style>
h1 {
font-family: "Helvetica";
color: #41b883;
}
</style>
Introduction to modern front-end with Vue.js
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button>
Become a better Vue.js developer
</button>
</div>
</template>
...
<script>
export default {
data () {
return {
clicksLeft: 5
}
}
}
</script>
Introduction to modern front-end with Vue.js
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button @click="decrementClicks">
Become a better Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
clicksLeft: 5
}
},
methods: {
decrementClicks () {
this.clicksLeft -= 1
}
}
}
</script>
Introduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.js
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button @click="decrementClicks">
Become a better Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
clicksLeft: 5
}
},
methods: {
decrementClicks () {
if (this.clicksLeft > 0) {
this.clicksLeft -= 1
}
}
}
}
</script>
Introduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.js
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="clicksLeft === 0">
Congratulations, you are a better Vue.js developer!
</h1>
<h1 v-else>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button @click="decrementClicks">
Become a better Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
clicksLeft: 5
}
},
methods: {
decrementClicks () {
if (this.clicksLeft > 0) {
this.clicksLeft -= 1
}
}
}
}
</script>
Introduction to modern front-end with Vue.js
Introduction to modern front-end with Vue.js
Looks familiar…
Before
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
</h1>
<h1 v-else>
Click below to become a Vue.js developer.
</h1>
<button @click="becomeVueDeveloper">
Become a Vue.js developer
</button>
</div>
</template>
Now
<template>
<div>
<h1 v-if="clicksLeft === 0">
Congratulations, you are a better
Vue.js developer!
</h1>
<h1 v-else>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button @click="decrementClicks">
Become a better Vue.js developer
</button>
</div>
</template>
Let’s become a better Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isBetterVueDeveloper">
Congratulations, you are a better
Vue.js developer!
</h1>
<h1 v-else>
Click {{ clicksLeft }} times to become
a better Vue.js developer.
</h1>
<button @click="decrementClicks">
Become a better Vue.js developer
</button>
</div>
</template>
<script>
export default {
data () {
return {
clicksLeft: 5
}
},
computed: {
isBetterVueDeveloper () {
return this.clicksLeft === 0
}
},
methods: {
decrementClicks () {
if (this.clicksLeft > 0) {
this.clicksLeft -= 1
}
}
}
}
</script>
What vs How?
Declarative (yay!)
● what should be shown
● what data means
● what happens on interaction
Imperative (nay)
● how should be rendered
● how data is computed
● how to update after changes
WHAT HOW
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1>
Check all things below to become a super Vue.js developer 0/4
</h1>
<ul>
<li><input type="checkbox"> knows v-if &amp; v-else</li>
<li><input type="checkbox"> knows methods &amp; computed</li>
<li><input type="checkbox"> knows v-model</li>
<li><input type="checkbox"> knows v-for</li>
</ul>
</div>
</template>
<style>
h1 {
font-family: "Helvetica";
color: #41b883;
}
li {
list-style: none;
font-size: 30px;
}
input[type="checkbox"] {
width: 20px;
height: 20px;
}
</style>
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1>
Check all things below to become a super
Vue.js developer {{ checkedCount }}/4
</h1>
<ul>
<li>
<input type="checkbox" v-model="isChecked">
knows v-if &amp; v-else
</li>
</ul>
</div>
</template>
<script>
export default {
data () {
return {
isChecked: false
}
},
computed: {
checkedCount () {
if (this.isChecked) return 1
return 0
}
}
}
</script>
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1>
Check all things below to become a super Vue.js developer
{{ checkedCount }}/4
</h1>
<ul>
<li>
<input type="checkbox" v-model="isChecked1"> knows v-if &amp; v-else
</li>
<li>
<input type="checkbox" v-model="isChecked2"> knows methods &amp; computed
</li>
<li>
<input type="checkbox" v-model="isChecked3"> knows v-model
</li>
<li>
<input type="checkbox" v-model="isChecked4"> knows v-for
</li>
</ul>
</div>
</template>
<script>
export default {
data () {
return {
isChecked1: false,
isChecked2: false,
isChecked3: false,
isChecked4: false
}
},
computed: {
checkedCount () {
// A lot of ifs...
}
}
}
</script>
pls dont
DRY
Don’t Repeat Yourself
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1>
Check all things below to become a super
Vue.js developer {{ checkedCount }}/4
</h1>
<ul>
<li v-for="item in items">
<input type="checkbox" v-model="item.isChecked">
knows v-if &amp; v-else
</li>
</ul>
</div>
</template>
<script>
export default {
data () {
return {
items: [
{ isChecked: false },
{ isChecked: false },
{ isChecked: false },
{ isChecked: false }
]
}
},
computed: {
checkedCount () {
return 0 // TODO
}
}
}
</script>
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1>
Check all things below to become a super
Vue.js developer {{ checkedCount }}/4
</h1>
<ul>
<li v-for="item in items">
<input type="checkbox" v-model="item.isChecked">
{{ item.description }}
</li>
</ul>
</div>
</template>
<script>
export default {
data () {
return {
items: [
{ isChecked: false, description: 'knows v-if & v-else' },
{ isChecked: false, description: 'knows methods & computed' },
{ isChecked: false, description: 'knows v-model' },
{ isChecked: false, description: 'knows v-for' }
]
}
},
computed: {
checkedCount () {
return 0 // TODO
}
}
}
</script>
Let’s become a super Vue.js developer!
Imperative (how)
computed: {
checkedCount () {
let count = 0
for (const item of this.items) {
if (item.isChecked) {
count += 1
}
}
return count
}
}
Declarative (what)
computed: {
checkedCount () {
return this.items
.filter(item => item.isChecked)
.length
}
}
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isSuperVueDeveloper">
Congratulations, you are a super Vue.js developer!
</h1>
<template v-else>
<h1>
Check all things below to become a super Vue.js developer
{{ checkedCount }}/4
</h1>
<ul>
<li v-for="item in items">
<input type="checkbox" v-model="item.isChecked">
{{ item.description }}
</li>
</ul>
</template>
</div>
</template>
<script>
export default {
data () {
...
},
computed: {
checkedCount () {
return this.items
.filter(item => item.isChecked)
.length
},
isSuperVueDeveloper () {
return this.checkedCount === 4
}
}
}
</script>
different stuff
Let’s become a super Vue.js developer!
Magical numbers
computed: {
isSuperVueDeveloper () {
return this.checkedCount === 4
}
}
Declarative logic
computed: {
isSuperVueDeveloper () {
return this.checkedCount === this.items.length
}
}
Let’s become a super Vue.js developer!
index.vue
<template>
<div>
<h1 v-if="isSuperVueDeveloper">
Congratulations, you are a super Vue.js developer!
</h1>
<template v-else>
<h1>
Check all things below to become a super Vue.js developer
{{ checkedCount }}/{{ items.length }}
</h1>
<ul>
<li v-for="item in items" :key="item.description">
<input type="checkbox" v-model="item.isChecked">
{{ item.description }}
</li>
</ul>
</template>
</div>
</template>
All together now!!!
first-challenge.vue
<template>
<div>
<h1 v-if="isVueDeveloper">
Congratulations, you are a Vue.js developer!
...
second-challenge.vue
<template>
<div>
<h1 v-if="isBetterVueDeveloper">
Congratulations, you are a better Vue.js developer!
...
third-challenge.vue
<template>
<div>
<h1 v-if="isSuperVueDeveloper">
Congratulations, you are a super Vue.js developer!
...
<template>
<main>
<FirstChallenge />
<hr />
<SecondChallenge />
<hr />
<ThirdChallenge />
</main>
</template>
<script>
import FirstChallenge from './first-challenge'
import SecondChallenge from './second-challenge'
import ThirdChallenge from './third-challenge'
export default {
components: {
FirstChallenge,
SecondChallenge,
ThirdChallenge
}
}
</script>
index.vue
What we learned
Vue.js
● data binding
● v-if, v-else
● methods
● computed
● v-model
● v-for, :key
Front-end
● components
● declarative style
● DRY
What’s yet to learn
● communication between components
● routing
● scoped styles
● transitions
● dynamic styles
● Pug, SCSS/Sass/Stylus/PostCSS
● ... everything else!
Where to learn
https://vuejs.org/v2/guide/
Workshops

More Related Content

What's hot (20)

Meet VueJs
Meet VueJs
Mathieu Breton
 
The Point of Vue - Intro to Vue.js
The Point of Vue - Intro to Vue.js
Holly Schinsky
 
VueJS Introduction
VueJS Introduction
David Ličen
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
Raymond Camden
 
Building a Single Page Application with VueJS
Building a Single Page Application with VueJS
danpastori
 
An introduction to Vue.js
An introduction to Vue.js
Javier Lafora Rey
 
Web components
Web components
Tudor Barbu
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Vue presentation
Vue presentation
Norbert Nader
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
houzman
 
Intro to Vue
Intro to Vue
Isatu Conteh
 
Love at first Vue
Love at first Vue
Dalibor Gogic
 
Building a js widget
Building a js widget
Tudor Barbu
 
Vue business first
Vue business first
Vitalii Ratyshnyi
 
Nuxt.JS Introdruction
Nuxt.JS Introdruction
David Ličen
 
Javascript MVVM with Vue.JS
Javascript MVVM with Vue.JS
Eueung Mulyana
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
introduction to Vue.js 3
introduction to Vue.js 3
ArezooKmn
 
The Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
 
Micronaut For Single Page Apps
Micronaut For Single Page Apps
Zachary Klein
 
The Point of Vue - Intro to Vue.js
The Point of Vue - Intro to Vue.js
Holly Schinsky
 
VueJS Introduction
VueJS Introduction
David Ličen
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
Raymond Camden
 
Building a Single Page Application with VueJS
Building a Single Page Application with VueJS
danpastori
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
houzman
 
Building a js widget
Building a js widget
Tudor Barbu
 
Nuxt.JS Introdruction
Nuxt.JS Introdruction
David Ličen
 
Javascript MVVM with Vue.JS
Javascript MVVM with Vue.JS
Eueung Mulyana
 
Real World Lessons in Progressive Web Application & Service Worker Caching
Real World Lessons in Progressive Web Application & Service Worker Caching
Chris Love
 
introduction to Vue.js 3
introduction to Vue.js 3
ArezooKmn
 
The Complementarity of React and Web Components
The Complementarity of React and Web Components
Andrew Rota
 
Micronaut For Single Page Apps
Micronaut For Single Page Apps
Zachary Klein
 

Similar to Introduction to modern front-end with Vue.js (20)

Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017
Matt Raible
 
Learning Svelte
Learning Svelte
Christoffer Noring
 
Day of code
Day of code
Evan Farr
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
DEVCON
 
Msbte polytechnic 22519 CSS Ch 6 By Syed Ateeq.pdf
Msbte polytechnic 22519 CSS Ch 6 By Syed Ateeq.pdf
faanjagirdar
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
 
Vue.js part1
Vue.js part1
욱래 김
 
WordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin Pages
Brandon Dove
 
Angular JS Introduction
Angular JS Introduction
Dhyego Fernando
 
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
cehwitham
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
ananelson
 
Introduction to AngularJS
Introduction to AngularJS
Marco Vito Moscaritolo
 
Angular js quickstart
Angular js quickstart
LinkMe Srl
 
HTML5, the new buzzword
HTML5, the new buzzword
Frédéric Harper
 
Django crush course
Django crush course
Mohammed El Rafie Tarabay
 
Agile Wordpress
Agile Wordpress
Filippo Dino
 
Sperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copy
Salvatore Iaconesi
 
Level up apps and websites with vue.js
Level up apps and websites with vue.js
Violetta Villani
 
Level up apps and websites with vue.js
Level up apps and websites with vue.js
Commit University
 
An introduction to Vue.js
An introduction to Vue.js
TO THE NEW Pvt. Ltd.
 
Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017
Matt Raible
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
DEVCON
 
Msbte polytechnic 22519 CSS Ch 6 By Syed Ateeq.pdf
Msbte polytechnic 22519 CSS Ch 6 By Syed Ateeq.pdf
faanjagirdar
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
freshlybakedpixels
 
WordPress Admin UI - Future Proofing Your Admin Pages
WordPress Admin UI - Future Proofing Your Admin Pages
Brandon Dove
 
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
Making WordPress Your CMS and Automatically Updating a Self Hosted WordPress ...
cehwitham
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
ananelson
 
Angular js quickstart
Angular js quickstart
LinkMe Srl
 
Sperimentazioni lezione6 from_designtoapplication copy
Sperimentazioni lezione6 from_designtoapplication copy
Salvatore Iaconesi
 
Level up apps and websites with vue.js
Level up apps and websites with vue.js
Violetta Villani
 
Level up apps and websites with vue.js
Level up apps and websites with vue.js
Commit University
 
Ad

More from monterail (9)

MonteTalks #2 Sales & Marketing — Love or Hate Relationship?
MonteTalks #2 Sales & Marketing — Love or Hate Relationship?
monterail
 
Emotional and Artificial Intelligence in Team Performance Software
Emotional and Artificial Intelligence in Team Performance Software
monterail
 
Marketing B2B at Monterail — Szymon Boniecki, co-founder
Marketing B2B at Monterail — Szymon Boniecki, co-founder
monterail
 
Storytelling in data visualization — Head of Design, Monterail
Storytelling in data visualization — Head of Design, Monterail
monterail
 
Girls in IT - QA
Girls in IT - QA
monterail
 
Monterail Academy — Visual screen design dla początkujących
Monterail Academy — Visual screen design dla początkujących
monterail
 
Girls in It - Front-end & Back-end. Jak zacząć
Girls in It - Front-end & Back-end. Jak zacząć
monterail
 
Girls in IT - Projektantka UI/UX. Jak zacząć?
Girls in IT - Projektantka UI/UX. Jak zacząć?
monterail
 
IoT Poland 2016 - Over the air deployment bringing business closer to agile
IoT Poland 2016 - Over the air deployment bringing business closer to agile
monterail
 
MonteTalks #2 Sales & Marketing — Love or Hate Relationship?
MonteTalks #2 Sales & Marketing — Love or Hate Relationship?
monterail
 
Emotional and Artificial Intelligence in Team Performance Software
Emotional and Artificial Intelligence in Team Performance Software
monterail
 
Marketing B2B at Monterail — Szymon Boniecki, co-founder
Marketing B2B at Monterail — Szymon Boniecki, co-founder
monterail
 
Storytelling in data visualization — Head of Design, Monterail
Storytelling in data visualization — Head of Design, Monterail
monterail
 
Girls in IT - QA
Girls in IT - QA
monterail
 
Monterail Academy — Visual screen design dla początkujących
Monterail Academy — Visual screen design dla początkujących
monterail
 
Girls in It - Front-end & Back-end. Jak zacząć
Girls in It - Front-end & Back-end. Jak zacząć
monterail
 
Girls in IT - Projektantka UI/UX. Jak zacząć?
Girls in IT - Projektantka UI/UX. Jak zacząć?
monterail
 
IoT Poland 2016 - Over the air deployment bringing business closer to agile
IoT Poland 2016 - Over the air deployment bringing business closer to agile
monterail
 
Ad

Recently uploaded (20)

FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
FME for Good: Integrating Multiple Data Sources with APIs to Support Local Ch...
Safe Software
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Supporting the NextGen 911 Digital Transformation with FME
Supporting the NextGen 911 Digital Transformation with FME
Safe Software
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
“From Enterprise to Makers: Driving Vision AI Innovation at the Extreme Edge,...
Edge AI and Vision Alliance
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
ENERGY CONSUMPTION CALCULATION IN ENERGY-EFFICIENT AIR CONDITIONER.pdf
Muhammad Rizwan Akram
 
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
AudGram Review: Build Visually Appealing, AI-Enhanced Audiograms to Engage Yo...
SOFTTECHHUB
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
“Addressing Evolving AI Model Challenges Through Memory and Storage,” a Prese...
Edge AI and Vision Alliance
 
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven Infrastructure
Safe Software
 
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Seminar: Authentication for a Billion Consumers - Amazon.pptx
FIDO Alliance
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Data Validation and System Interoperability
Data Validation and System Interoperability
Safe Software
 

Introduction to modern front-end with Vue.js

  • 1. Introduction to modern front-end with Vue.js Ivan Nikulin Monterail Academy, Nov. 2017
  • 5. Hello Vue world! index.vue <template> <h1>Hello Vue world!</h1> </template> terminal npm install -g [email protected] vue build index.vue
  • 7. Hello Vue world! index.vue <template> <h1>Hello Vue world!</h1> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style>
  • 9. Hello Vue.js world! index.vue <template> <h1>Hello {{ title }} world!</h1> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style> ... <script> export default { data () { return { title: 'Vue.js' } } } </script>
  • 10. Hello Vue.js world! index.vue <template> <h1>Hello {{ title }} world!</h1> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style> ... <script> export default { data () { return { title: 'Vue.js' } } } </script>
  • 12. Hello wild world! index.vue <template> <h1>Hello {{ title }} world!</h1> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style> ... <script> export default { data () { return { title: 'wild' } } } </script>
  • 14. Hello maths world! index.vue <template> <div> <h1>Hello {{ title }} world!</h1> <pre>{{ a }} + {{ b }} = {{ a + b }}</pre> </div> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style> ... <script> export default { data () { return { title: 'math', a: 2, b: 3 } } } </script>
  • 16. Hello maths world! index.vue <template> <div> <h1>Hello {{ title }} world!</h1> <pre :title="description"> {{ a }} + {{ b }} = {{ a + b }} </pre> </div> </template> <style> h1 { font-family: "Helvetica"; color: #1a94da; } </style> ... <script> export default { data () { return { title: 'math', a: 2, b: 3, description: 'formula' } } } </script>
  • 18. HTML elements vs components
  • 19. HTML elements vs components
  • 20. Let’s become a Vue.js developer! index.vue <template> <div> <h1> Click below to become a Vue.js developer. </h1> <button> Become a Vue.js developer </button> </div> </template> ... <style> h1 { font-family: "Helvetica"; color: #41b883; } </style>
  • 22. Let’s become a Vue.js developer! index.vue <template> <div> <h1> Congratulations, you’re a Vue.js developer! </h1> <h1> Click below to become a Vue.js developer. </h1> <button> Become a Vue.js developer </button> </div> </template> ... <style> h1 { font-family: "Helvetica"; color: #41b883; } </style>
  • 24. Let’s become a Vue.js developer! index.vue <template> <div> <h1> Congratulations, you are a Vue.js developer! </h1> <h1> Click below to become a Vue.js developer. </h1> <button> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } } } </script>
  • 25. Let’s become a Vue.js developer! index.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1> Click below to become a Vue.js developer. </h1> <button> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } } } </script>
  • 27. Let’s become a Vue.js developer! index.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1 v-if="!isVueDeveloper"> Click below to become a Vue.js developer. </h1> <button> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } } } </script>
  • 29. Let’s become a Vue.js developer! index.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1 v-if="!isVueDeveloper"> Click below to become a Vue.js developer. </h1> <button @click="isVueDeveloper = true"> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } } } </script>
  • 30. Let’s become a Vue.js developer! index.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1 v-else> Click below to become a Vue.js developer. </h1> <button @click="isVueDeveloper = true"> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } } } </script>
  • 31. Let’s become a Vue.js developer! index.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1 v-else> Click below to become a Vue.js developer. </h1> <button @click="becomeVueDeveloper"> Become a Vue.js developer </button> </div> </template> <script> export default { data () { return { isVueDeveloper: false } }, methods: { becomeVueDeveloper () { this.isVueDeveloper = true } } } </script>
  • 32. What is ES6 anyway? ES6 <script> export default { data () { return { isVueDeveloper: false } }, methods: { becomeVueDeveloper () { this.isVueDeveloper = true } } } </script> ES5 <script> module.exports = { data: function () { return { isVueDeveloper: false } }, methods: { becomeVueDeveloper: function () { this.isVueDeveloper = true } } } </script>
  • 33. Let’s become a better Vue.js developer! index.vue <template> <div> <h1> Click 5 times to become a better Vue.js developer. </h1> <button> Become a better Vue.js developer </button> </div> </template> ... <style> h1 { font-family: "Helvetica"; color: #41b883; } </style>
  • 35. Let’s become a better Vue.js developer! index.vue <template> <div> <h1> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button> Become a better Vue.js developer </button> </div> </template> ... <script> export default { data () { return { clicksLeft: 5 } } } </script>
  • 37. Let’s become a better Vue.js developer! index.vue <template> <div> <h1> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button @click="decrementClicks"> Become a better Vue.js developer </button> </div> </template> <script> export default { data () { return { clicksLeft: 5 } }, methods: { decrementClicks () { this.clicksLeft -= 1 } } } </script>
  • 40. Let’s become a better Vue.js developer! index.vue <template> <div> <h1> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button @click="decrementClicks"> Become a better Vue.js developer </button> </div> </template> <script> export default { data () { return { clicksLeft: 5 } }, methods: { decrementClicks () { if (this.clicksLeft > 0) { this.clicksLeft -= 1 } } } } </script>
  • 43. Let’s become a better Vue.js developer! index.vue <template> <div> <h1 v-if="clicksLeft === 0"> Congratulations, you are a better Vue.js developer! </h1> <h1 v-else> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button @click="decrementClicks"> Become a better Vue.js developer </button> </div> </template> <script> export default { data () { return { clicksLeft: 5 } }, methods: { decrementClicks () { if (this.clicksLeft > 0) { this.clicksLeft -= 1 } } } } </script>
  • 46. Looks familiar… Before <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! </h1> <h1 v-else> Click below to become a Vue.js developer. </h1> <button @click="becomeVueDeveloper"> Become a Vue.js developer </button> </div> </template> Now <template> <div> <h1 v-if="clicksLeft === 0"> Congratulations, you are a better Vue.js developer! </h1> <h1 v-else> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button @click="decrementClicks"> Become a better Vue.js developer </button> </div> </template>
  • 47. Let’s become a better Vue.js developer! index.vue <template> <div> <h1 v-if="isBetterVueDeveloper"> Congratulations, you are a better Vue.js developer! </h1> <h1 v-else> Click {{ clicksLeft }} times to become a better Vue.js developer. </h1> <button @click="decrementClicks"> Become a better Vue.js developer </button> </div> </template> <script> export default { data () { return { clicksLeft: 5 } }, computed: { isBetterVueDeveloper () { return this.clicksLeft === 0 } }, methods: { decrementClicks () { if (this.clicksLeft > 0) { this.clicksLeft -= 1 } } } } </script>
  • 48. What vs How? Declarative (yay!) ● what should be shown ● what data means ● what happens on interaction Imperative (nay) ● how should be rendered ● how data is computed ● how to update after changes WHAT HOW
  • 49. Let’s become a super Vue.js developer! index.vue <template> <div> <h1> Check all things below to become a super Vue.js developer 0/4 </h1> <ul> <li><input type="checkbox"> knows v-if &amp; v-else</li> <li><input type="checkbox"> knows methods &amp; computed</li> <li><input type="checkbox"> knows v-model</li> <li><input type="checkbox"> knows v-for</li> </ul> </div> </template> <style> h1 { font-family: "Helvetica"; color: #41b883; } li { list-style: none; font-size: 30px; } input[type="checkbox"] { width: 20px; height: 20px; } </style>
  • 50. Let’s become a super Vue.js developer! index.vue <template> <div> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/4 </h1> <ul> <li> <input type="checkbox" v-model="isChecked"> knows v-if &amp; v-else </li> </ul> </div> </template> <script> export default { data () { return { isChecked: false } }, computed: { checkedCount () { if (this.isChecked) return 1 return 0 } } } </script>
  • 51. Let’s become a super Vue.js developer! index.vue <template> <div> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/4 </h1> <ul> <li> <input type="checkbox" v-model="isChecked1"> knows v-if &amp; v-else </li> <li> <input type="checkbox" v-model="isChecked2"> knows methods &amp; computed </li> <li> <input type="checkbox" v-model="isChecked3"> knows v-model </li> <li> <input type="checkbox" v-model="isChecked4"> knows v-for </li> </ul> </div> </template> <script> export default { data () { return { isChecked1: false, isChecked2: false, isChecked3: false, isChecked4: false } }, computed: { checkedCount () { // A lot of ifs... } } } </script>
  • 54. Let’s become a super Vue.js developer! index.vue <template> <div> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/4 </h1> <ul> <li v-for="item in items"> <input type="checkbox" v-model="item.isChecked"> knows v-if &amp; v-else </li> </ul> </div> </template> <script> export default { data () { return { items: [ { isChecked: false }, { isChecked: false }, { isChecked: false }, { isChecked: false } ] } }, computed: { checkedCount () { return 0 // TODO } } } </script>
  • 55. Let’s become a super Vue.js developer! index.vue <template> <div> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/4 </h1> <ul> <li v-for="item in items"> <input type="checkbox" v-model="item.isChecked"> {{ item.description }} </li> </ul> </div> </template> <script> export default { data () { return { items: [ { isChecked: false, description: 'knows v-if & v-else' }, { isChecked: false, description: 'knows methods & computed' }, { isChecked: false, description: 'knows v-model' }, { isChecked: false, description: 'knows v-for' } ] } }, computed: { checkedCount () { return 0 // TODO } } } </script>
  • 56. Let’s become a super Vue.js developer! Imperative (how) computed: { checkedCount () { let count = 0 for (const item of this.items) { if (item.isChecked) { count += 1 } } return count } } Declarative (what) computed: { checkedCount () { return this.items .filter(item => item.isChecked) .length } }
  • 57. Let’s become a super Vue.js developer! index.vue <template> <div> <h1 v-if="isSuperVueDeveloper"> Congratulations, you are a super Vue.js developer! </h1> <template v-else> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/4 </h1> <ul> <li v-for="item in items"> <input type="checkbox" v-model="item.isChecked"> {{ item.description }} </li> </ul> </template> </div> </template> <script> export default { data () { ... }, computed: { checkedCount () { return this.items .filter(item => item.isChecked) .length }, isSuperVueDeveloper () { return this.checkedCount === 4 } } } </script> different stuff
  • 58. Let’s become a super Vue.js developer! Magical numbers computed: { isSuperVueDeveloper () { return this.checkedCount === 4 } } Declarative logic computed: { isSuperVueDeveloper () { return this.checkedCount === this.items.length } }
  • 59. Let’s become a super Vue.js developer! index.vue <template> <div> <h1 v-if="isSuperVueDeveloper"> Congratulations, you are a super Vue.js developer! </h1> <template v-else> <h1> Check all things below to become a super Vue.js developer {{ checkedCount }}/{{ items.length }} </h1> <ul> <li v-for="item in items" :key="item.description"> <input type="checkbox" v-model="item.isChecked"> {{ item.description }} </li> </ul> </template> </div> </template>
  • 60. All together now!!! first-challenge.vue <template> <div> <h1 v-if="isVueDeveloper"> Congratulations, you are a Vue.js developer! ... second-challenge.vue <template> <div> <h1 v-if="isBetterVueDeveloper"> Congratulations, you are a better Vue.js developer! ... third-challenge.vue <template> <div> <h1 v-if="isSuperVueDeveloper"> Congratulations, you are a super Vue.js developer! ... <template> <main> <FirstChallenge /> <hr /> <SecondChallenge /> <hr /> <ThirdChallenge /> </main> </template> <script> import FirstChallenge from './first-challenge' import SecondChallenge from './second-challenge' import ThirdChallenge from './third-challenge' export default { components: { FirstChallenge, SecondChallenge, ThirdChallenge } } </script> index.vue
  • 61. What we learned Vue.js ● data binding ● v-if, v-else ● methods ● computed ● v-model ● v-for, :key Front-end ● components ● declarative style ● DRY
  • 62. What’s yet to learn ● communication between components ● routing ● scoped styles ● transitions ● dynamic styles ● Pug, SCSS/Sass/Stylus/PostCSS ● ... everything else!