SlideShare a Scribd company logo
/home/s/home/samundrak/Desktop/vue/00-featured-vuejs-v2-alpha-release.jpg​am
undrak/Desktop/vue/00-featured-vuejs-v2-alpha-release.jpg​
Vue, VueRouter & Vuex
Samundra Khatri
What is Vue?
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 very easy to pick up and integrate with other libraries or existing
projects. On the other hand, Vue is also perfectly capable of powering
sophisticated Single-Page Applications when used in combination with modern
tooling and supporting libraries.
Usage
You can simply create an .html file and include Vue with:
Vue
Components
Components are one of the most powerful
features of Vue. They help you extend
basic HTML elements to encapsulate
reusable code. At a high level,
components are custom elements that
Vue’s compiler attaches behavior to. In
some cases, they may also appear as a
native HTML element extended with the
special is attribute.
Single File Components
In many Vue projects, global components will be defined using Vue.component, followed
by new Vue({ el: '#container' }) to target a container element in the body of every page.
This can work very well for small to medium-sized projects, where JavaScript is only
used to enhance certain views. In more complex projects however, or when your
frontend is entirely driven by JavaScript, these disadvantages become apparent:
we can use preprocessors such as Pug,
Babel (with ES2015 modules), and Stylus
for cleaner and more feature-rich
components.
Routing Vue Apps with VueRouter
VueRouter is a client side routing library by VueJS team for making Single page application.
Routing & Navigating
Defining routes. Injecting routes to app
Routing & Navigating
● router.push('home') // literal string
● router.push({ path: 'home' }) // object
● router.push({ name: 'user', params: { userId: 123 }}) // named route
● router.push({ path: 'register', query: { plan: 'private' }}) // with query, resulting
in /register?plan=private
● router.go(1) // go forward by one record, the same as history.forward()
● router.go(-1) // go back by one record, the same as history.back()
VUEX
Vuex is a state management pattern +
library for Vue.js applications. It serves as
a centralized store for all the components
in an application, with rules ensuring that
the state can only be mutated in a
predictable fashion. It also integrates with
Vue's official devtools extension to
provide advanced features such as
zero-config time-travel debugging and
state snapshot export / import.
Problems of local states & need of Vuex
● States can be mutate by any child or sibling components.
● Once app will grow we will lost on searching the code where the state has
been mutated.
● To much event listeners and emitters.
● Once component will be destroyed all component state will be gone.
● No chance of recovery of lost old component state.
● Have to define same states for every components.
● Violation of Single source of truth.
So Vuex
● Vuex is like kathmandu where every thing
is stored and available.
● Single source of truth
● No state loss while any component is
destroyed
● Centralized data store, can be fetched
from any component at anytime.
● No direct mutation of state from any
component at any time
Core Concepts of Vuex
1. State
2. Getters
3. Mutations
4. Actions
5. Modules
Core Concepts of Vuex
Vuex: State
Vuex uses a single state tree - that is, this single
object contains all your application level state
and serves as the "single source of truth". This
also means usually you will have only one store
for each application. A single state tree makes it
straightforward to locate a specific piece of
state, and allows us to easily take snapshots of
the current app state for debugging purposes.
export
Declaring
Vuex: State
Vuex uses a single state tree - that is, this single
object contains all your application level state
and serves as the "single source of truth". This
also means usually you will have only one store
for each application. A single state tree makes it
straightforward to locate a specific piece of
state, and allows us to easily take snapshots of
the current app state for debugging purposes.
export
Accessing
Vuex: mapState
When a component needs to make use of
multiple store state properties or getters,
declaring all these computed properties can get
repetitive and verbose. To deal with this we can
make use of the mapState helper which
generates computed getter functions for us and
help us save some keystrokes:
export
Vuex: Getters
Sometimes we may need to compute derived state based on store state, for example filtering through
a list of items and counting them
Declaring Accessing
Vuex: mapGetters
The mapGetters helper simply maps store getters to local computed properties:
Vuex: Mutations
It is a commonly seen pattern to use constants
for mutation types in various Flux
implementations. This allow the code to take
advantage of tooling like linters, and putting all
constants in a single file allows your
collaborators to get an at-a-glance view of what
mutations are possible in the entire application
export
Vuex: Commiting Mutations
To invoke a mutation handler, you need to call store.commit with its type
1 2
Vuex: Actions
Actions are similar to mutations, the difference
being that:
● Instead of mutating the state, actions
commit mutations.
● Actions can contain arbitrary
asynchronous operations.
export
Vuex: Dispatching Actions
Actions support the same payload format and object-style dispatch:
Vuex: Async Actions
For asynchronous task like api calls or for
delays we can use actions to commit mutations
when api call is success or failed. Also we can
map actions like getters or state.
export
Vuex: Modules
Due to using a single state tree, all state of our
application is contained inside one big object.
However, as our application grows in scale, the
store can get really bloated.
To help with that, Vuex allows us to divide our
store into modules. Each module can contain its
own state, mutations, actions, getters, and even
nested modules - it's fractal all the way down:
export
Putting Vuex and Vue together
Vuex Store Vue App
Vuex: Application Structure
export
References
● https://vuejs.org
● https://vuex.vuejs.org
● http://router.vuejs.org/
ThankVue
ThankYou
&

More Related Content

What's hot (20)

CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
Rachel Andrew
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
Javier Lafora Rey
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
TechMagic
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
David Ličen
 
Angular 9
Angular 9 Angular 9
Angular 9
Raja Vishnu
 
Intro to React
Intro to ReactIntro to React
Intro to React
Justin Reock
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
Bernd Alter
 
Reactjs
Reactjs Reactjs
Reactjs
Neha Sharma
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Maulik Shah
 
Spring Boot
Spring BootSpring Boot
Spring Boot
Jiayun Zhou
 
Vue JS Intro
Vue JS IntroVue JS Intro
Vue JS Intro
Muhammad Rizki Rijal
 
Vue.js
Vue.jsVue.js
Vue.js
Jadson Santos
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js
선협 이
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
Bethmi Gunasekara
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
Jimit Shah
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
Sergey Romaneko
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
Thanh Tuong
 
React state
React  stateReact  state
React state
Ducat
 
CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout CSS Day: CSS Grid Layout
CSS Day: CSS Grid Layout
Rachel Andrew
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
TechMagic
 
VueJS Introduction
VueJS IntroductionVueJS Introduction
VueJS Introduction
David Ličen
 
Introduction to VueJS & Vuex
Introduction to VueJS & VuexIntroduction to VueJS & Vuex
Introduction to VueJS & Vuex
Bernd Alter
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Understanding react hooks
Understanding react hooksUnderstanding react hooks
Understanding react hooks
Maulik Shah
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
Deep dive into Vue.js
Deep dive into Vue.jsDeep dive into Vue.js
Deep dive into Vue.js
선협 이
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
Jimit Shah
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
Thanh Tuong
 
React state
React  stateReact  state
React state
Ducat
 

Viewers also liked (20)

WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
houzman
 
Nl be WordPress vertaling
Nl be WordPress vertalingNl be WordPress vertaling
Nl be WordPress vertaling
Dave Loodts
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013
Roy Russo
 
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
 
Amit PPT
Amit PPTAmit PPT
Amit PPT
Sahil Arora
 
Storytime updated ppt
Storytime updated pptStorytime updated ppt
Storytime updated ppt
nolenlib
 
Santa Khinche sabki taang
Santa Khinche sabki taang Santa Khinche sabki taang
Santa Khinche sabki taang
sadaambalvi
 
Quiz for ut iii pps
Quiz for ut iii ppsQuiz for ut iii pps
Quiz for ut iii pps
shajugeorge
 
srthsrth
srthsrthsrthsrth
srthsrth
nn2141485
 
The Potato Story 一袋土豆
The Potato Story 一袋土豆The Potato Story 一袋土豆
The Potato Story 一袋土豆
Joe Carter
 
Linus Torvalds Just For Fun
Linus Torvalds Just For FunLinus Torvalds Just For Fun
Linus Torvalds Just For Fun
pps_ps
 
Description of goods
Description of goodsDescription of goods
Description of goods
Phương Nga Ngọc Nguyễn
 
ASD
ASDASD
ASD
Sage Island
 
Memuary Tetrad 1
Memuary Tetrad 1Memuary Tetrad 1
Memuary Tetrad 1
Denis Golikov
 
Thi cong coc khoan nhoi va coc barret pgs.ts le kieu
Thi cong coc khoan nhoi va coc barret   pgs.ts le kieuThi cong coc khoan nhoi va coc barret   pgs.ts le kieu
Thi cong coc khoan nhoi va coc barret pgs.ts le kieu
Đỗ Quang Định
 
Medicaid vs. Medicare in Oregon
Medicaid vs. Medicare in OregonMedicaid vs. Medicare in Oregon
Medicaid vs. Medicare in Oregon
Richard Schneider
 
Chance challenge change Arise Roby
Chance challenge change   Arise RobyChance challenge change   Arise Roby
Chance challenge change Arise Roby
Arise Roby
 
Computer science-view notices
Computer science-view noticesComputer science-view notices
Computer science-view notices
Azad public school
 
舞舞
Lim Shi Ting
 
WordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQLWordPress 2017 with VueJS and GraphQL
WordPress 2017 with VueJS and GraphQL
houzman
 
Nl be WordPress vertaling
Nl be WordPress vertalingNl be WordPress vertaling
Nl be WordPress vertaling
Dave Loodts
 
ElasticSearch AJUG 2013
ElasticSearch AJUG 2013ElasticSearch AJUG 2013
ElasticSearch AJUG 2013
Roy Russo
 
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
 
Storytime updated ppt
Storytime updated pptStorytime updated ppt
Storytime updated ppt
nolenlib
 
Santa Khinche sabki taang
Santa Khinche sabki taang Santa Khinche sabki taang
Santa Khinche sabki taang
sadaambalvi
 
Quiz for ut iii pps
Quiz for ut iii ppsQuiz for ut iii pps
Quiz for ut iii pps
shajugeorge
 
The Potato Story 一袋土豆
The Potato Story 一袋土豆The Potato Story 一袋土豆
The Potato Story 一袋土豆
Joe Carter
 
Linus Torvalds Just For Fun
Linus Torvalds Just For FunLinus Torvalds Just For Fun
Linus Torvalds Just For Fun
pps_ps
 
Thi cong coc khoan nhoi va coc barret pgs.ts le kieu
Thi cong coc khoan nhoi va coc barret   pgs.ts le kieuThi cong coc khoan nhoi va coc barret   pgs.ts le kieu
Thi cong coc khoan nhoi va coc barret pgs.ts le kieu
Đỗ Quang Định
 
Medicaid vs. Medicare in Oregon
Medicaid vs. Medicare in OregonMedicaid vs. Medicare in Oregon
Medicaid vs. Medicare in Oregon
Richard Schneider
 
Chance challenge change Arise Roby
Chance challenge change   Arise RobyChance challenge change   Arise Roby
Chance challenge change Arise Roby
Arise Roby
 
Ad

Similar to Vue, vue router, vuex (20)

Vue.js - An Introduction
Vue.js - An IntroductionVue.js - An Introduction
Vue.js - An Introduction
saadulde
 
Introducing Vuex in your project
Introducing Vuex in your projectIntroducing Vuex in your project
Introducing Vuex in your project
Denny Biasiolli
 
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
 
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with VuexGITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Indonesia
 
Vue.js - AMS & Vuex
Vue.js - AMS & VuexVue.js - AMS & Vuex
Vue.js - AMS & Vuex
Emanuell Dan Minciu
 
Vue Vuex 101
Vue Vuex 101Vue Vuex 101
Vue Vuex 101
LocNguyen362
 
Introduction to VueJS for begginers with examples | Namspace IT
Introduction to VueJS for begginers with examples | Namspace ITIntroduction to VueJS for begginers with examples | Namspace IT
Introduction to VueJS for begginers with examples | Namspace IT
namespaceit
 
Basics of Vue.js 2019
Basics of Vue.js 2019Basics of Vue.js 2019
Basics of Vue.js 2019
Paul Bele
 
Vue.js is boring - and that's a good thing
Vue.js is boring - and that's a good thingVue.js is boring - and that's a good thing
Vue.js is boring - and that's a good thing
Joonas Lehtonen
 
Love at first Vue
Love at first VueLove at first Vue
Love at first Vue
Dalibor Gogic
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02
Paul Bele
 
Vuex
VuexVuex
Vuex
Asaquzzaman Mishu
 
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Katy Slemon
 
A New Vue for Web Development
A New Vue for Web DevelopmentA New Vue for Web Development
A New Vue for Web Development
Chad Campbell
 
Vue.js
Vue.jsVue.js
Vue.js
BADR
 
Vue js and Vue Material
Vue js and Vue MaterialVue js and Vue Material
Vue js and Vue Material
Eueung Mulyana
 
Progressive Javascript: Why React when you can Vue?
Progressive Javascript: Why React when you can Vue?Progressive Javascript: Why React when you can Vue?
Progressive Javascript: Why React when you can Vue?
Sonal Raj
 
VueJS: The Simple Revolution
VueJS: The Simple RevolutionVueJS: The Simple Revolution
VueJS: The Simple Revolution
Rafael Casuso Romate
 
An introduction to Vue.js
An introduction to Vue.jsAn introduction to Vue.js
An introduction to Vue.js
TO THE NEW Pvt. Ltd.
 
Why Choose Vue.js For Web Development Projects.pptx
Why Choose Vue.js For Web Development Projects.pptxWhy Choose Vue.js For Web Development Projects.pptx
Why Choose Vue.js For Web Development Projects.pptx
Scala Code
 
Vue.js - An Introduction
Vue.js - An IntroductionVue.js - An Introduction
Vue.js - An Introduction
saadulde
 
Introducing Vuex in your project
Introducing Vuex in your projectIntroducing Vuex in your project
Introducing Vuex in your project
Denny Biasiolli
 
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
 
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with VuexGITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Class #19: Build Large Scale Vue.js Apps with Vuex
GITS Indonesia
 
Introduction to VueJS for begginers with examples | Namspace IT
Introduction to VueJS for begginers with examples | Namspace ITIntroduction to VueJS for begginers with examples | Namspace IT
Introduction to VueJS for begginers with examples | Namspace IT
namespaceit
 
Basics of Vue.js 2019
Basics of Vue.js 2019Basics of Vue.js 2019
Basics of Vue.js 2019
Paul Bele
 
Vue.js is boring - and that's a good thing
Vue.js is boring - and that's a good thingVue.js is boring - and that's a good thing
Vue.js is boring - and that's a good thing
Joonas Lehtonen
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02
Paul Bele
 
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Why do JavaScript enthusiast think of Vue.js for building real-time web appli...
Katy Slemon
 
A New Vue for Web Development
A New Vue for Web DevelopmentA New Vue for Web Development
A New Vue for Web Development
Chad Campbell
 
Vue.js
Vue.jsVue.js
Vue.js
BADR
 
Vue js and Vue Material
Vue js and Vue MaterialVue js and Vue Material
Vue js and Vue Material
Eueung Mulyana
 
Progressive Javascript: Why React when you can Vue?
Progressive Javascript: Why React when you can Vue?Progressive Javascript: Why React when you can Vue?
Progressive Javascript: Why React when you can Vue?
Sonal Raj
 
Why Choose Vue.js For Web Development Projects.pptx
Why Choose Vue.js For Web Development Projects.pptxWhy Choose Vue.js For Web Development Projects.pptx
Why Choose Vue.js For Web Development Projects.pptx
Scala Code
 
Ad

Recently uploaded (20)

FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
Bryan K. O'Rourke
 
Food Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptxFood Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptx
Sakthi Sundar
 
From Idea to Impact: Maximizing Your Hackathon Performance
From Idea to Impact: Maximizing Your Hackathon PerformanceFrom Idea to Impact: Maximizing Your Hackathon Performance
From Idea to Impact: Maximizing Your Hackathon Performance
outsystemspuneusergr
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptxpresentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
Media of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptxMedia of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptx
bugisatrioadiwibowo
 
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
jenicahmendoza1
 
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEWTHE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
rspyamin
 
Sample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdfSample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdf
Joseph Juntilla
 
Jadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptxJadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptx
roslan17
 
Assesement_PPT Designer -----------Final
Assesement_PPT Designer -----------FinalAssesement_PPT Designer -----------Final
Assesement_PPT Designer -----------Final
RajeshKumarKumre
 
The Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysisThe Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysis
Dr. Anshula Garg
 
Personal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptxPersonal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptx
GedeJuliana2
 
Diddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptxDiddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptx
RanitMal
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
AI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial IntelligenceAI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial Intelligence
sayalikerimova20
 
case ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentationcase ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentation
fortuneassey
 
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdfTHE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
sethjamcam
 
Bob Stewart Acts 17 Study 06 11 2025.pptx
Bob Stewart Acts 17 Study 06 11 2025.pptxBob Stewart Acts 17 Study 06 11 2025.pptx
Bob Stewart Acts 17 Study 06 11 2025.pptx
FamilyWorshipCenterD
 
Pentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptxPentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptx
FamilyWorshipCenterD
 
Presentation SoftwareNOTES AND USES..pdf
Presentation SoftwareNOTES AND USES..pdfPresentation SoftwareNOTES AND USES..pdf
Presentation SoftwareNOTES AND USES..pdf
bathyates
 
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
FUTURE OF FITNESS 2025 KEYNOTE BRYAN OROURKE BEYOND ACTIV SINGAPORE 2025
Bryan K. O'Rourke
 
Food Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptxFood Truck Business Plan | Sakthi Sundar.pptx
Food Truck Business Plan | Sakthi Sundar.pptx
Sakthi Sundar
 
From Idea to Impact: Maximizing Your Hackathon Performance
From Idea to Impact: Maximizing Your Hackathon PerformanceFrom Idea to Impact: Maximizing Your Hackathon Performance
From Idea to Impact: Maximizing Your Hackathon Performance
outsystemspuneusergr
 
presentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptxpresentacion de Inspire Power Point.pptx
presentacion de Inspire Power Point.pptx
teamspro
 
Media of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptxMedia of Advertisement-How to choose it.pptx
Media of Advertisement-How to choose it.pptx
bugisatrioadiwibowo
 
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)Types of Information Sources (Primary, Secondary, and Tertiary Sources)
Types of Information Sources (Primary, Secondary, and Tertiary Sources)
jenicahmendoza1
 
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEWTHE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
THE INTERIOR REVIEW MEDIA KIT - THE INTERIOR REVIEW
rspyamin
 
Sample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdfSample work (PL Product Research) Joseph_Juntilla.pdf
Sample work (PL Product Research) Joseph_Juntilla.pdf
Joseph Juntilla
 
Jadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptxJadual Waktu dan Jadual Bertugas kelas.pptx
Jadual Waktu dan Jadual Bertugas kelas.pptx
roslan17
 
Assesement_PPT Designer -----------Final
Assesement_PPT Designer -----------FinalAssesement_PPT Designer -----------Final
Assesement_PPT Designer -----------Final
RajeshKumarKumre
 
The Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysisThe Power of religious Symbols: A scientific and spiritual analysis
The Power of religious Symbols: A scientific and spiritual analysis
Dr. Anshula Garg
 
Personal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptxPersonal letter personal letter personal letter.pptx
Personal letter personal letter personal letter.pptx
GedeJuliana2
 
Diddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptxDiddy Baby oil making tutorial (natural ingresients.pptx
Diddy Baby oil making tutorial (natural ingresients.pptx
RanitMal
 
Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025Presenation - compensation plan - Mining Race - NEW - June 2025
Presenation - compensation plan - Mining Race - NEW - June 2025
Mining RACE
 
AI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial IntelligenceAI Intelligence: Exploring the Future of Artificial Intelligence
AI Intelligence: Exploring the Future of Artificial Intelligence
sayalikerimova20
 
case ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentationcase ObGy - Post term pregnacy.pptx case presentation
case ObGy - Post term pregnacy.pptx case presentation
fortuneassey
 
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdfTHE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
THE HISTORY AND EVOLUTION OF VARIOUS SWORDS.pdf
sethjamcam
 
Bob Stewart Acts 17 Study 06 11 2025.pptx
Bob Stewart Acts 17 Study 06 11 2025.pptxBob Stewart Acts 17 Study 06 11 2025.pptx
Bob Stewart Acts 17 Study 06 11 2025.pptx
FamilyWorshipCenterD
 
Pentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptxPentecost Sunday A Promise of Power.pptx
Pentecost Sunday A Promise of Power.pptx
FamilyWorshipCenterD
 
Presentation SoftwareNOTES AND USES..pdf
Presentation SoftwareNOTES AND USES..pdfPresentation SoftwareNOTES AND USES..pdf
Presentation SoftwareNOTES AND USES..pdf
bathyates
 

Vue, vue router, vuex

  • 2. What is Vue? 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 very easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.
  • 3. Usage You can simply create an .html file and include Vue with:
  • 4. Vue Components Components are one of the most powerful features of Vue. They help you extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements that Vue’s compiler attaches behavior to. In some cases, they may also appear as a native HTML element extended with the special is attribute.
  • 5. Single File Components In many Vue projects, global components will be defined using Vue.component, followed by new Vue({ el: '#container' }) to target a container element in the body of every page. This can work very well for small to medium-sized projects, where JavaScript is only used to enhance certain views. In more complex projects however, or when your frontend is entirely driven by JavaScript, these disadvantages become apparent:
  • 6. we can use preprocessors such as Pug, Babel (with ES2015 modules), and Stylus for cleaner and more feature-rich components.
  • 7. Routing Vue Apps with VueRouter VueRouter is a client side routing library by VueJS team for making Single page application.
  • 8. Routing & Navigating Defining routes. Injecting routes to app
  • 9. Routing & Navigating ● router.push('home') // literal string ● router.push({ path: 'home' }) // object ● router.push({ name: 'user', params: { userId: 123 }}) // named route ● router.push({ path: 'register', query: { plan: 'private' }}) // with query, resulting in /register?plan=private ● router.go(1) // go forward by one record, the same as history.forward() ● router.go(-1) // go back by one record, the same as history.back()
  • 10. VUEX Vuex is a state management pattern + library for Vue.js applications. It serves as a centralized store for all the components in an application, with rules ensuring that the state can only be mutated in a predictable fashion. It also integrates with Vue's official devtools extension to provide advanced features such as zero-config time-travel debugging and state snapshot export / import.
  • 11. Problems of local states & need of Vuex ● States can be mutate by any child or sibling components. ● Once app will grow we will lost on searching the code where the state has been mutated. ● To much event listeners and emitters. ● Once component will be destroyed all component state will be gone. ● No chance of recovery of lost old component state. ● Have to define same states for every components. ● Violation of Single source of truth.
  • 12. So Vuex ● Vuex is like kathmandu where every thing is stored and available. ● Single source of truth ● No state loss while any component is destroyed ● Centralized data store, can be fetched from any component at anytime. ● No direct mutation of state from any component at any time
  • 13. Core Concepts of Vuex 1. State 2. Getters 3. Mutations 4. Actions 5. Modules
  • 15. Vuex: State Vuex uses a single state tree - that is, this single object contains all your application level state and serves as the "single source of truth". This also means usually you will have only one store for each application. A single state tree makes it straightforward to locate a specific piece of state, and allows us to easily take snapshots of the current app state for debugging purposes. export Declaring
  • 16. Vuex: State Vuex uses a single state tree - that is, this single object contains all your application level state and serves as the "single source of truth". This also means usually you will have only one store for each application. A single state tree makes it straightforward to locate a specific piece of state, and allows us to easily take snapshots of the current app state for debugging purposes. export Accessing
  • 17. Vuex: mapState When a component needs to make use of multiple store state properties or getters, declaring all these computed properties can get repetitive and verbose. To deal with this we can make use of the mapState helper which generates computed getter functions for us and help us save some keystrokes: export
  • 18. Vuex: Getters Sometimes we may need to compute derived state based on store state, for example filtering through a list of items and counting them Declaring Accessing
  • 19. Vuex: mapGetters The mapGetters helper simply maps store getters to local computed properties:
  • 20. Vuex: Mutations It is a commonly seen pattern to use constants for mutation types in various Flux implementations. This allow the code to take advantage of tooling like linters, and putting all constants in a single file allows your collaborators to get an at-a-glance view of what mutations are possible in the entire application export
  • 21. Vuex: Commiting Mutations To invoke a mutation handler, you need to call store.commit with its type 1 2
  • 22. Vuex: Actions Actions are similar to mutations, the difference being that: ● Instead of mutating the state, actions commit mutations. ● Actions can contain arbitrary asynchronous operations. export
  • 23. Vuex: Dispatching Actions Actions support the same payload format and object-style dispatch:
  • 24. Vuex: Async Actions For asynchronous task like api calls or for delays we can use actions to commit mutations when api call is success or failed. Also we can map actions like getters or state. export
  • 25. Vuex: Modules Due to using a single state tree, all state of our application is contained inside one big object. However, as our application grows in scale, the store can get really bloated. To help with that, Vuex allows us to divide our store into modules. Each module can contain its own state, mutations, actions, getters, and even nested modules - it's fractal all the way down: export
  • 26. Putting Vuex and Vue together Vuex Store Vue App