SlideShare a Scribd company logo
Vue.js - part 1
Vue.js - inswave systems, 2018 1
Concept overview
Vue (pronounced /vjuː/, like view) is a progressive framework
for building user interfaces. Unlike other monolithic
frameworks, Vue is designed from the ground up to be
incrementally adoptable. The core library is focused on the
view layer only, and is easy to pick up and integrate with
other libraries or existing projects.
Vue.js - inswave systems, 2018 2
MVVM
Backend Client & MVC .
DB , Model View
.
Vue.js - inswave systems, 2018 3
MVVM in Vue
Vue.js - inswave systems, 2018 4
View Instance - ViewModel
Every Vue application starts by creating a new Vue instance with the Vue
function:
new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!'
}
});
Although not strictly associated with the MVVM pattern, Vue’s design was
partly inspired by it.
Vue.js - inswave systems, 2018 5
View Instance(Option)
el DOM
data
template HTML, CSS
method
created View Instance
Vue.js - inswave systems, 2018 6
View
The actual DOM that is managed by Vue instances.
vm.$el // The View
Vue.js - inswave systems, 2018 7
Model
A slightly modified plain JavaScript
object.
vm.$data // The Model
Vue.js - inswave systems, 2018 8
Directive
Prefixed HTML attributes that tell Vue.js to do something about
a DOM element.
<div v-text="message"></div>
Vue.js - inswave systems, 2018 9
Mustache Bindings
You can also use mustache-style bindings, both in text and in
attributes. They are translated into v-text and v-attr directives
under the hood. For example:
<div id="person-{{id}}">Hello {{name}}!</div>
Vue.js - inswave systems, 2018 10
Filters
Filters are functions used to process the raw values before
updating the View. They are denoted by a “pipe” inside
directives or bindings:
<div>{{message | capitalize}}</div>
Vue.js - inswave systems, 2018 11
Quick example
<div id="demo">
<h1>{{title | uppercase}}</h1>
<ul>
<li v-repeat="todos" v-on="click: done = !done"
class="{{done ? 'done' : ''}}">
{{content}}
</li>
</ul>
</div>
( ...)
Vue.js - inswave systems, 2018 12
Quick example
var demo = new Vue({
el: '#demo',
data: {
title: 'todos',
todos: [
{done: true, content: 'JavaScript'},
{done: false, content: 'Vue.js'}
]
}
})
Vue.js - inswave systems, 2018 13
View Instance View Instance DOM
.
Vue.js - inswave systems, 2018 14
Lifecycle
1. new Vue()
2. => beforeCreate
3. => created
4. el, template => beforeMount
5. $el el => mounted
6.
7. => beforeUpdate
8. => updated
9.
10. => beforeDestroy
11. , => destroyed
12.
Vue.js - inswave systems, 2018 15
Vue.js - inswave systems, 2018 16
Vue.component()
<script>Vue.component('my-global-component', {})</script>
<div id="app">
<my-global-component></my-global-component>
</div>
Vue.js - inswave systems, 2018 17
components
<script>
new Vue({
el: '#app',
components: {
'my-local-component' : { template: '<div>local component</div>'}
}
});
</script>
<div id="app">
<my-local-component></my-local-component>
</div>
Vue.js - inswave systems, 2018 18
• (props )
•
•
Vue.js - inswave systems, 2018 19
• props
• HTML v-bind:
<script>
Vue.component('child-component', {
props: ['propsdata'],
});
</script>
<child-component v-bind:props =" data ">
</child-component>
Vue.js - inswave systems, 2018 20
<script>
Vue.component('child-component', {
props: ['propsdata'],
template: '<p>{{ propsdata }}</p>'
});
new Vue({
el: '#app',
data: {message:'Hello Vue! passed from Parent Component'}
});
</script>
<div id="app>
<child-component v-bind:propsdata="message"></child-component>
</div>
Vue.js - inswave systems, 2018 21
<script>
//
this.$emit(' ')
</script>
<child-component v-on: =" ">
</child-component>
Vue.js - inswave systems, 2018 22
<div id="app">
<my-local-component v-on:show-log="printText"></my-local-component>
</div>
<script>
new Vue({
el: '#app',
components: {
'my-local-component' : {
template: '<button v-on:click="showLog">showLog</button>',
methods: {showLog: function() {this.$emit('show-log');}}
}
},
methods: {printText: function() {console.log('recevied an event');}}
});
</script>
Vue.js - inswave systems, 2018 23
.
.
//
var eventBus = new Vue();
//
methods: {
method : function() { eventBus.$emit(' ', ); }
}
//
methods: {
created: function() { eventBus.$on(" ", function( ) { ... }); }
}
Vue.js - inswave systems, 2018 24
<div id="app">
<my-local-component></my-local-component>
</div>
<script>
var eventBus = new Vue();
new Vue({
el: '#app',
components: {
'my-local-component' : {
template: '<button v-on:click="showLog">showLog</button>',
methods: {
showLog: function() {eventBus.$emit('sendEvent', 'data');}
}
}
},
created: function() {
eventBus.$on('sendEvent', function(retVal) {
console.log('recevied an event : ' + retVal);
});
}
});
</script>
Vue.js - inswave systems, 2018 25
v-bind Shorthand
<!-- full syntax -->
<a v-bind:href="url"> ... </a>
<!-- shorthand -->
<a :href="url"> ... </a>
Vue.js - inswave systems, 2018 26
v-on Shorthand
<!-- full syntax -->
<a v-on:click="doSomething"> ... </a>
<!-- shorthand -->
<a @click="doSomething"> ... </a>
Vue.js - inswave systems, 2018 27
• : SPA .
• :
<router-link to="URL " . <a>
to URL
<router-view> . URL
Vue.js - inswave systems, 2018 28
<div id="app">
<h1> </h1>
<p>
<router-link to="/main"> </router-link>
</p>
<router-view></router-view>
</div>
<script>
var Main = { template : '<div>main</div>' };
var routes = [
{ path: '/main', component: Main }
];
var router = new VueRouter({routes});
var app = new Vue({router}).$mount('#app');
</script>
Vue.js - inswave systems, 2018 29
<router-view> . route children
.
<div id="app"><router-view></router-view></div>
<script>
var User = {template: '<div>User<router-view></router-view></div>';};
var UserProfile = { template: '<p>User Profile Component</p>'};
var routes = [{
path: '/user', component: User,
children: [{path: 'profile',component: UserProfile}]
}];
var router = new VueRouter({routes});
var app = new Vue({router}).$mount('#app');
</script>
Vue.js - inswave systems, 2018 30
name <router-view> . default .
<div id="app">
<router-view name="header"></router-view>
<router-view></router-view>
<router-view name="footer"></router-view>
</div>
<script>
var Header = {template: '<div>Header Component</div>'};
var Footer = {template: '<div>Footer Component</div>'};
var Body = {template: '<div>Body Component</div>'};
var routes = [{path: '/',
components: {default:Body, header:Header, footer:Footer}}];
var router = new VueRouter({routes});
Vue.js - inswave systems, 2018 31
vs
Vue.js - inswave systems, 2018 32
Vue.js - inswave systems, 2018 33

More Related Content

PDF
Modern frontend development with VueJs
PDF
Room with a Vue - Introduction to Vue.js
PDF
Love at first Vue
PDF
Vue js and Vue Material
PDF
The Point of Vue - Intro to Vue.js
PPTX
Vue business first
PPTX
Web components
PDF
Modern frontend development with VueJs
Room with a Vue - Introduction to Vue.js
Love at first Vue
Vue js and Vue Material
The Point of Vue - Intro to Vue.js
Vue business first
Web components

What's hot (20)

PPTX
An introduction to Vue.js
PDF
VueJS Introduction
PDF
An introduction to Vue.js
PDF
Why Vue.js?
PDF
Introduction to VueJS & Vuex
PPT
Vue.js Getting Started
PPTX
Vue presentation
ODP
An Introduction to Vuejs
PDF
Building a js widget
PDF
Vue, vue router, vuex
PDF
Vaadin 7 CN
PDF
Vue routing tutorial getting started with vue router
PPTX
How to Build SPA with Vue Router 2.0
PDF
Vue js 大型專案架構
PDF
How to Build ToDo App with Vue 3 + TypeScript
PDF
Vaadin Components @ Angular U
PPTX
Vue 2.0 + Vuex Router & Vuex at Vue.js
PDF
Building and deploying React applications
PDF
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
An introduction to Vue.js
VueJS Introduction
An introduction to Vue.js
Why Vue.js?
Introduction to VueJS & Vuex
Vue.js Getting Started
Vue presentation
An Introduction to Vuejs
Building a js widget
Vue, vue router, vuex
Vaadin 7 CN
Vue routing tutorial getting started with vue router
How to Build SPA with Vue Router 2.0
Vue js 大型專案架構
How to Build ToDo App with Vue 3 + TypeScript
Vaadin Components @ Angular U
Vue 2.0 + Vuex Router & Vuex at Vue.js
Building and deploying React applications
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Ad

Similar to Vue.js part1 (20)

PDF
Meet VueJs
PPTX
An introduction to Vue.js
PPT
Vanjs backbone-powerpoint
PPTX
Vue js and Dyploma
PDF
Vue JS Interview Questions By Scholarhat
PDF
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
PPTX
Membangun Moderen UI dengan Vue.js
PDF
Vue js 2.x
PDF
How to Webpack your Django!
PPTX
MVVM Lights
PDF
Front End Development for Back End Developers - Denver Startup Week 2017
PPTX
Level up apps and websites with vue.js
PPTX
Level up apps and websites with vue.js
PDF
Backbone js
PDF
Workshop: Building Vaadin add-ons
PPTX
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
PDF
Vue.js for beginners
PPTX
Django + Vue, JavaScript de 3ª generación para modernizar Django
PDF
Introducing Vuex in your project
PDF
State manager in Vue.js, from zero to Vuex
Meet VueJs
An introduction to Vue.js
Vanjs backbone-powerpoint
Vue js and Dyploma
Vue JS Interview Questions By Scholarhat
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Membangun Moderen UI dengan Vue.js
Vue js 2.x
How to Webpack your Django!
MVVM Lights
Front End Development for Back End Developers - Denver Startup Week 2017
Level up apps and websites with vue.js
Level up apps and websites with vue.js
Backbone js
Workshop: Building Vaadin add-ons
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
Vue.js for beginners
Django + Vue, JavaScript de 3ª generación para modernizar Django
Introducing Vuex in your project
State manager in Vue.js, from zero to Vuex
Ad

More from 욱래 김 (8)

PDF
0003 es5 핵심 정리
PDF
엔터프라이즈 웹 동향 및 적용사례
PDF
차세대 웹(Html5) 플랫폼의 동향과 기업 업무 적용 방안
PDF
W3C TPAC 2014
PDF
HTML5 플랫폼 동향과 기업업무 적용 방안
PDF
강의자료 차세대 웹(Html5) 플랫폼의 동향과 구축 방안
PDF
HTML5 & Hybrid App Trends
PDF
스마트시대를 준비하는 웹표준 RIA
0003 es5 핵심 정리
엔터프라이즈 웹 동향 및 적용사례
차세대 웹(Html5) 플랫폼의 동향과 기업 업무 적용 방안
W3C TPAC 2014
HTML5 플랫폼 동향과 기업업무 적용 방안
강의자료 차세대 웹(Html5) 플랫폼의 동향과 구축 방안
HTML5 & Hybrid App Trends
스마트시대를 준비하는 웹표준 RIA

Recently uploaded (20)

PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Digital Strategies for Manufacturing Companies
PDF
Understanding Forklifts - TECH EHS Solution
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
medical staffing services at VALiNTRY
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administraation Chapter 3
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms I-SECS-1021-03
How to Choose the Right IT Partner for Your Business in Malaysia
Digital Strategies for Manufacturing Companies
Understanding Forklifts - TECH EHS Solution
How Creative Agencies Leverage Project Management Software.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Wondershare Filmora 15 Crack With Activation Key [2025
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
medical staffing services at VALiNTRY
CHAPTER 2 - PM Management and IT Context
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How to Migrate SBCGlobal Email to Yahoo Easily
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administraation Chapter 3

Vue.js part1

  • 1. Vue.js - part 1 Vue.js - inswave systems, 2018 1
  • 2. Concept overview Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. Vue.js - inswave systems, 2018 2
  • 3. MVVM Backend Client & MVC . DB , Model View . Vue.js - inswave systems, 2018 3
  • 4. MVVM in Vue Vue.js - inswave systems, 2018 4
  • 5. View Instance - ViewModel Every Vue application starts by creating a new Vue instance with the Vue function: new Vue({ el: '#app', data: { message: 'Hello Vue.js!' } }); Although not strictly associated with the MVVM pattern, Vue’s design was partly inspired by it. Vue.js - inswave systems, 2018 5
  • 6. View Instance(Option) el DOM data template HTML, CSS method created View Instance Vue.js - inswave systems, 2018 6
  • 7. View The actual DOM that is managed by Vue instances. vm.$el // The View Vue.js - inswave systems, 2018 7
  • 8. Model A slightly modified plain JavaScript object. vm.$data // The Model Vue.js - inswave systems, 2018 8
  • 9. Directive Prefixed HTML attributes that tell Vue.js to do something about a DOM element. <div v-text="message"></div> Vue.js - inswave systems, 2018 9
  • 10. Mustache Bindings You can also use mustache-style bindings, both in text and in attributes. They are translated into v-text and v-attr directives under the hood. For example: <div id="person-{{id}}">Hello {{name}}!</div> Vue.js - inswave systems, 2018 10
  • 11. Filters Filters are functions used to process the raw values before updating the View. They are denoted by a “pipe” inside directives or bindings: <div>{{message | capitalize}}</div> Vue.js - inswave systems, 2018 11
  • 12. Quick example <div id="demo"> <h1>{{title | uppercase}}</h1> <ul> <li v-repeat="todos" v-on="click: done = !done" class="{{done ? 'done' : ''}}"> {{content}} </li> </ul> </div> ( ...) Vue.js - inswave systems, 2018 12
  • 13. Quick example var demo = new Vue({ el: '#demo', data: { title: 'todos', todos: [ {done: true, content: 'JavaScript'}, {done: false, content: 'Vue.js'} ] } }) Vue.js - inswave systems, 2018 13
  • 14. View Instance View Instance DOM . Vue.js - inswave systems, 2018 14
  • 15. Lifecycle 1. new Vue() 2. => beforeCreate 3. => created 4. el, template => beforeMount 5. $el el => mounted 6. 7. => beforeUpdate 8. => updated 9. 10. => beforeDestroy 11. , => destroyed 12. Vue.js - inswave systems, 2018 15
  • 16. Vue.js - inswave systems, 2018 16
  • 18. components <script> new Vue({ el: '#app', components: { 'my-local-component' : { template: '<div>local component</div>'} } }); </script> <div id="app"> <my-local-component></my-local-component> </div> Vue.js - inswave systems, 2018 18
  • 19. • (props ) • • Vue.js - inswave systems, 2018 19
  • 20. • props • HTML v-bind: <script> Vue.component('child-component', { props: ['propsdata'], }); </script> <child-component v-bind:props =" data "> </child-component> Vue.js - inswave systems, 2018 20
  • 21. <script> Vue.component('child-component', { props: ['propsdata'], template: '<p>{{ propsdata }}</p>' }); new Vue({ el: '#app', data: {message:'Hello Vue! passed from Parent Component'} }); </script> <div id="app> <child-component v-bind:propsdata="message"></child-component> </div> Vue.js - inswave systems, 2018 21
  • 22. <script> // this.$emit(' ') </script> <child-component v-on: =" "> </child-component> Vue.js - inswave systems, 2018 22
  • 23. <div id="app"> <my-local-component v-on:show-log="printText"></my-local-component> </div> <script> new Vue({ el: '#app', components: { 'my-local-component' : { template: '<button v-on:click="showLog">showLog</button>', methods: {showLog: function() {this.$emit('show-log');}} } }, methods: {printText: function() {console.log('recevied an event');}} }); </script> Vue.js - inswave systems, 2018 23
  • 24. . . // var eventBus = new Vue(); // methods: { method : function() { eventBus.$emit(' ', ); } } // methods: { created: function() { eventBus.$on(" ", function( ) { ... }); } } Vue.js - inswave systems, 2018 24
  • 25. <div id="app"> <my-local-component></my-local-component> </div> <script> var eventBus = new Vue(); new Vue({ el: '#app', components: { 'my-local-component' : { template: '<button v-on:click="showLog">showLog</button>', methods: { showLog: function() {eventBus.$emit('sendEvent', 'data');} } } }, created: function() { eventBus.$on('sendEvent', function(retVal) { console.log('recevied an event : ' + retVal); }); } }); </script> Vue.js - inswave systems, 2018 25
  • 26. v-bind Shorthand <!-- full syntax --> <a v-bind:href="url"> ... </a> <!-- shorthand --> <a :href="url"> ... </a> Vue.js - inswave systems, 2018 26
  • 27. v-on Shorthand <!-- full syntax --> <a v-on:click="doSomething"> ... </a> <!-- shorthand --> <a @click="doSomething"> ... </a> Vue.js - inswave systems, 2018 27
  • 28. • : SPA . • : <router-link to="URL " . <a> to URL <router-view> . URL Vue.js - inswave systems, 2018 28
  • 29. <div id="app"> <h1> </h1> <p> <router-link to="/main"> </router-link> </p> <router-view></router-view> </div> <script> var Main = { template : '<div>main</div>' }; var routes = [ { path: '/main', component: Main } ]; var router = new VueRouter({routes}); var app = new Vue({router}).$mount('#app'); </script> Vue.js - inswave systems, 2018 29
  • 30. <router-view> . route children . <div id="app"><router-view></router-view></div> <script> var User = {template: '<div>User<router-view></router-view></div>';}; var UserProfile = { template: '<p>User Profile Component</p>'}; var routes = [{ path: '/user', component: User, children: [{path: 'profile',component: UserProfile}] }]; var router = new VueRouter({routes}); var app = new Vue({router}).$mount('#app'); </script> Vue.js - inswave systems, 2018 30
  • 31. name <router-view> . default . <div id="app"> <router-view name="header"></router-view> <router-view></router-view> <router-view name="footer"></router-view> </div> <script> var Header = {template: '<div>Header Component</div>'}; var Footer = {template: '<div>Footer Component</div>'}; var Body = {template: '<div>Body Component</div>'}; var routes = [{path: '/', components: {default:Body, header:Header, footer:Footer}}]; var router = new VueRouter({routes}); Vue.js - inswave systems, 2018 31
  • 32. vs Vue.js - inswave systems, 2018 32
  • 33. Vue.js - inswave systems, 2018 33