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

What's hot

Vuex
VuexVuex
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Pagepro
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
David Ličen
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Javier Lafora Rey
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
Jonathan Goode
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
Bernd Alter
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting Started
Murat Doğan
 
Vue presentation
Vue presentationVue presentation
Vue presentation
Norbert Nader
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
Paddy Lock
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
Tudor Barbu
 
Vue, vue router, vuex
Vue, vue router, vuexVue, vue router, vuex
Vue, vue router, vuex
Samundra khatri
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
jojule
 
Vue routing tutorial getting started with vue router
Vue routing tutorial getting started with vue routerVue routing tutorial getting started with vue router
Vue routing tutorial getting started with vue router
Katy Slemon
 
How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0
Takuya Tejima
 
Vue js 大型專案架構
Vue js 大型專案架構Vue js 大型專案架構
Vue js 大型專案架構
Hina Chen
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
Katy Slemon
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
Joonas Lehtinen
 
Vue 2.0 + Vuex Router & Vuex at Vue.js
Vue 2.0 + Vuex Router & Vuex at Vue.jsVue 2.0 + Vuex Router & Vuex at Vue.js
Vue 2.0 + Vuex Router & Vuex at Vue.js
Takuya Tejima
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
Astrails
 
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Luciano Mammino
 

What's hot (20)

Vuex
VuexVuex
Vuex
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
 
Vue.js Getting Started
Vue.js Getting StartedVue.js Getting Started
Vue.js Getting Started
 
Vue presentation
Vue presentationVue presentation
Vue presentation
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
 
Building a js widget
Building a js widgetBuilding a js widget
Building a js widget
 
Vue, vue router, vuex
Vue, vue router, vuexVue, vue router, vuex
Vue, vue router, vuex
 
Vaadin 7 CN
Vaadin 7 CNVaadin 7 CN
Vaadin 7 CN
 
Vue routing tutorial getting started with vue router
Vue routing tutorial getting started with vue routerVue routing tutorial getting started with vue router
Vue routing tutorial getting started with vue router
 
How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0How to Build SPA with Vue Router 2.0
How to Build SPA with Vue Router 2.0
 
Vue js 大型專案架構
Vue js 大型專案架構Vue js 大型專案架構
Vue js 大型專案架構
 
How to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScriptHow to Build ToDo App with Vue 3 + TypeScript
How to Build ToDo App with Vue 3 + TypeScript
 
Vaadin Components @ Angular U
Vaadin Components @ Angular UVaadin Components @ Angular U
Vaadin Components @ Angular U
 
Vue 2.0 + Vuex Router & Vuex at Vue.js
Vue 2.0 + Vuex Router & Vuex at Vue.jsVue 2.0 + Vuex Router & Vuex at Vue.js
Vue 2.0 + Vuex Router & Vuex at Vue.js
 
Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
 
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
Universal JS Web Applications with React - Luciano Mammino - Codemotion Rome ...
 

Similar to Vue.js part1

Meet VueJs
Meet VueJsMeet VueJs
Meet VueJs
Mathieu Breton
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
TO THE NEW Pvt. Ltd.
 
Vanjs backbone-powerpoint
Vanjs backbone-powerpointVanjs backbone-powerpoint
Vanjs backbone-powerpoint
Michael Yagudaev
 
Vue js and Dyploma
Vue js and DyplomaVue js and Dyploma
Vue js and Dyploma
Yoram Kornatzky
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Codemotion
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
Froyo Framework
 
Vue js 2.x
Vue js 2.xVue js 2.x
Vue js 2.x
Suresh Velusamy
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
David Gibbons
 
MVVM Lights
MVVM LightsMVVM Lights
MVVM Lights
Denis Voituron
 
Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017
Matt Raible
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel 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.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
Commit University
 
Backbone js
Backbone jsBackbone js
Backbone js
Rohan Chandane
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
Sami Ekblad
 
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
Gavin Pickin
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
Julio Bitencourt
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
Javier Abadía
 
State manager in Vue.js, from zero to Vuex
State manager in Vue.js, from zero to VuexState manager in Vue.js, from zero to Vuex
State manager in Vue.js, from zero to Vuex
Commit University
 
Introducing Vuex in your project
Introducing Vuex in your projectIntroducing Vuex in your project
Introducing Vuex in your project
Denny Biasiolli
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
Alexander Zamkovyi
 

Similar to Vue.js part1 (20)

Meet VueJs
Meet VueJsMeet VueJs
Meet VueJs
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
 
Vanjs backbone-powerpoint
Vanjs backbone-powerpointVanjs backbone-powerpoint
Vanjs backbone-powerpoint
 
Vue js and Dyploma
Vue js and DyplomaVue js and Dyploma
Vue js and Dyploma
 
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
Universal JavaScript Web Applications with React - Luciano Mammino - Codemoti...
 
Membangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.jsMembangun Moderen UI dengan Vue.js
Membangun Moderen UI dengan Vue.js
 
Vue js 2.x
Vue js 2.xVue js 2.x
Vue js 2.x
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
MVVM Lights
MVVM LightsMVVM Lights
MVVM Lights
 
Front End Development for Back End Developers - Denver Startup Week 2017
Front End Development for Back End Developers - Denver Startup Week 2017Front End Development for Back End Developers - Denver Startup Week 2017
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.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
 
Level up apps and websites with vue.js
Level up  apps and websites with vue.jsLevel up  apps and websites with vue.js
Level up apps and websites with vue.js
 
Backbone js
Backbone jsBackbone js
Backbone js
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
ColdBox APIs + VueJS - powering Mobile, Desktop and Web Apps with 1 VueJS cod...
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Django + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar DjangoDjango + Vue, JavaScript de 3ª generación para modernizar Django
Django + Vue, JavaScript de 3ª generación para modernizar Django
 
State manager in Vue.js, from zero to Vuex
State manager in Vue.js, from zero to VuexState manager in Vue.js, from zero to Vuex
State manager in Vue.js, from zero to Vuex
 
Introducing Vuex in your project
Introducing Vuex in your projectIntroducing Vuex in your project
Introducing Vuex in your project
 
Google app engine by example
Google app engine by exampleGoogle app engine by example
Google app engine by example
 

More from 욱래 김

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

More from 욱래 김 (8)

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

Recently uploaded

J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
Jhone kinadey
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
kalichargn70th171
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
Alberto Brandolini
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
Envertis Software Solutions
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 

Recently uploaded (20)

J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Boost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management AppsBoost Your Savings with These Money Management Apps
Boost Your Savings with These Money Management Apps
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
The Power of Visual Regression Testing_ Why It Is Critical for Enterprise App...
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
Modelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - AmsterdamModelling Up - DDDEurope 2024 - Amsterdam
Modelling Up - DDDEurope 2024 - Amsterdam
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 

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