SlideShare a Scribd company logo
Kuro Hsu
kurotanshi@gmail.com
Vue.js
改
• Kuro Hsu
• @
• http://kuro.tw
• kurotanshi [at] gmail.com
Agenda
• Vue.js
• Vue
• Vue
• Vue
• Class
•
• Vue
•
Vue.js
• JS /
• view
• view
•
• (SPA, Single Page Application)
10 vue.js
http://goo.gl/RVQwop
MVVM (Model-View-ViewModel)
http://goo.gl/8n2bGr
Vue.js
vue.js
vue-cli
$ npm install -g vue-cli
$ vue init webpack-simple [project name]
$ cd [project name]
$ npm install
$ npm run dev
Properties & Methods
: VUE.JS ( ) https://goo.gl/s3livG
( root instance )
第一次用 Vue.js 就愛上 [改]
Vue
Vue.js IE8
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
AngularJS 1.x
ReactJS
第一次用 Vue.js 就愛上 [改]
Lifecycle
Vue
第一次用 Vue.js 就愛上 [改]
第一次用 Vue.js 就愛上 [改]
第一次用 Vue.js 就愛上 [改]
第一次用 Vue.js 就愛上 [改]
• init
• created
• beforeCompile
• compiled
• ready
lifecycle hooks
• attached
• detached
• beforeDestroy
• destroyed
• init
• created
• beforeCompile
• compiled
• ready
• attached
• detached
lifecycle hooks in Vue 2.0
• beforeDestroy
• destroyed
• beforeMount
• mounted
• beforeUpdate
• updated
• activated
• deactivated
ref: https://github.com/vuejs/vue/issues/2873#upgrade-tips
Data Binding
• Vue mustache template 

{{ }}
<span>Message: {{ msg }}</span>
: {{* msg }}
HTML : {{{ raw_html }}}
HTML : <div id="item-{{ id }}"></div>
• {{ var a = 1 }}
• {{ if (ok) { return message } }}
• {{ number + 1 }}
• {{ ok ? 'YES' : 'NO' }}
• {{ msg.split('').reverse().join('') }}
computed
directives
angularJS Vue.js
directive
( ) 



http://cn.vuejs.org/api/
v-model
http://goo.gl/SWbcKb
v-bind
http://goo.gl/dk0rZC
filter
• Vue.js {{ }} 

| filter
• {{ 'abc' | capitalize }}

==> Abc
• {{ 'abc' | uppercase }}

==> ABC
• {{ 123456 | currency }}

==> $123,456.00
Computed Properties
• {{ }}
view
• vue computed
http://goo.gl/sHkYqF
Class and Style
class
http://goo.gl/xqJgp9
Conditional & List Rendering
v-if / v-else
http://goo.gl/HJt73r
v-show
with template
v-if v-show
• v-if v-show DOM v-if
• v-show CSS
(style)
• v-show
v-for
http://goo.gl/BwuHYB
http://goo.gl/z0CcH3
v-for with object
http://goo.gl/Ela7PF
v-for with range
http://goo.gl/9ggJ5F
v-for with filter
http://goo.gl/nxw9I3
http://goo.gl/KRsMPM
http://goo.gl/IPwiib
: track-by
v-for id
Vue track-by
Event Handling
v-on
http://goo.gl/Gf9hCL
第一次用 Vue.js 就愛上 [改]
Modifiers
第一次用 Vue.js 就愛上 [改]
第一次用 Vue.js 就愛上 [改]
Transitions
http://goo.gl/Ws0e2v
第一次用 Vue.js 就愛上 [改]
transition with jQuery animate
http://goo.gl/g4xRXt
Components
Components
• Component vue
HTML
• HTML
第一次用 Vue.js 就愛上 [改]
❌
props
• scope
• prop .sync
.once
http://goo.gl/52SIzs
null
• prop 

• this.$parent 

this.$root
• this.$children ( )
this.$children v-if
v-ref
http://goo.gl/umMf39
第一次用 Vue.js 就愛上 [改]
第一次用 Vue.js 就愛上 [改]
• $on()
• $emit()
• $dispatch()
• $broadcast()
• DOM Event
callback
callback function return true
http://goo.gl/phpbDQ
第一次用 Vue.js 就愛上 [改]
:is
http://goo.gl/K0Zrps
第一次用 Vue.js 就愛上 [改]
keep-alive
•
keep-alive
第一次用 Vue.js 就愛上 [改]


http://goo.gl/lErGx4
slot
• angular transclusion
• W3C web-components slot
• slot
http://goo.gl/vmxj9G
Tools & Resources
Vue.js dev-tools
https://goo.gl/T6Fvtu
Vue-cli
https://github.com/vuejs/vue-cli
vue-cli
$ npm install -g vue-cli
$ vue init webpack-simple [project name]
$ cd [project name]
$ npm install
$ npm run dev
HTML
Script
Style
Vue file
Awesome Vue.js
https://github.com/vuejs/awesome-vue
Next,… Vue 2.0 !
•
• Vue 1.0 API
• 

https://github.com/vuejs/vue/issues/2873
第一次用 Vue.js 就愛上 [改]
Thanks

More Related Content

What's hot (20)

PPTX
Node.js Express
Eyal Vardi
 
PDF
Crud tutorial en
forkgrown
 
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
PDF
The Point of Vue - Intro to Vue.js
Holly Schinsky
 
PDF
Vue, vue router, vuex
Samundra khatri
 
PPTX
Vue js for beginner
Chandrasekar G
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
PPTX
Express JS
Alok Guha
 
PDF
Why Vue.js?
Jonathan Goode
 
PPTX
Introduction to laravel framework
Ahmad Fatoni
 
PPTX
Introduction Node.js
Erik van Appeldoorn
 
PPTX
Express js
Manav Prasad
 
PDF
Arquitetura Node com NestJS
Vanessa Me Tonini
 
PDF
Ansible Tutorial.pdf
NigussMehari4
 
PDF
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
PPTX
Ansible presentation
Suresh Kumar
 
PPTX
Basics of Vue.js 2019
Paul Bele
 
PDF
Nodejs Explained with Examples
Gabriele Lana
 
PDF
Use Node.js to create a REST API
Fabien Vauchelles
 
PPTX
NodeJS guide for beginners
Enoch Joshua
 
Node.js Express
Eyal Vardi
 
Crud tutorial en
forkgrown
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
The Point of Vue - Intro to Vue.js
Holly Schinsky
 
Vue, vue router, vuex
Samundra khatri
 
Vue js for beginner
Chandrasekar G
 
NodeJS for Beginner
Apaichon Punopas
 
Express JS
Alok Guha
 
Why Vue.js?
Jonathan Goode
 
Introduction to laravel framework
Ahmad Fatoni
 
Introduction Node.js
Erik van Appeldoorn
 
Express js
Manav Prasad
 
Arquitetura Node com NestJS
Vanessa Me Tonini
 
Ansible Tutorial.pdf
NigussMehari4
 
TypeScript: coding JavaScript without the pain
Sander Mak (@Sander_Mak)
 
Ansible presentation
Suresh Kumar
 
Basics of Vue.js 2019
Paul Bele
 
Nodejs Explained with Examples
Gabriele Lana
 
Use Node.js to create a REST API
Fabien Vauchelles
 
NodeJS guide for beginners
Enoch Joshua
 

Similar to 第一次用 Vue.js 就愛上 [改] (20)

PDF
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
PDF
Vue 淺談前端建置工具
andyyou
 
PPTX
An introduction to Vue.js
Pagepro
 
PDF
Play Framework on Google App Engine
Fred Lin
 
PDF
Drupal point of vue
David Ličen
 
PPTX
Vue js and Dyploma
Yoram Kornatzky
 
PPTX
A New Vue for Web Development
Chad Campbell
 
PDF
125 고성능 web view-deview 2013 발표 자료_공유용
NAVER D2
 
PDF
Love at first Vue
Dalibor Gogic
 
PPTX
Vue 2.0 + Vuex Router & Vuex at Vue.js
Takuya Tejima
 
PPTX
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 
PDF
Voorhoede - Front-end architecture
Jasper Moelker
 
KEY
Play Support in Cloud Foundry
rajdeep
 
PPTX
Let's vue
Plane Chao
 
PDF
以Vue開發電子商務網站
架構與眉角
Mei-yu Chen
 
PDF
Integration Test Cucumber + Webrat + Selenium
tka
 
PDF
Module, AMD, RequireJS
偉格 高
 
PDF
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Boni García
 
PPTX
Introduction to web application development with Vue (for absolute beginners)...
Lucas Jellema
 
PDF
Modern JavaScript, without giving up on Rails
Jonathan Johnson
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Vue 淺談前端建置工具
andyyou
 
An introduction to Vue.js
Pagepro
 
Play Framework on Google App Engine
Fred Lin
 
Drupal point of vue
David Ličen
 
Vue js and Dyploma
Yoram Kornatzky
 
A New Vue for Web Development
Chad Campbell
 
125 고성능 web view-deview 2013 발표 자료_공유용
NAVER D2
 
Love at first Vue
Dalibor Gogic
 
Vue 2.0 + Vuex Router & Vuex at Vue.js
Takuya Tejima
 
Single Page Application Development with backbone.js and Simple.Web
Chris Canal
 
Voorhoede - Front-end architecture
Jasper Moelker
 
Play Support in Cloud Foundry
rajdeep
 
Let's vue
Plane Chao
 
以Vue開發電子商務網站
架構與眉角
Mei-yu Chen
 
Integration Test Cucumber + Webrat + Selenium
tka
 
Module, AMD, RequireJS
偉格 高
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Boni García
 
Introduction to web application development with Vue (for absolute beginners)...
Lucas Jellema
 
Modern JavaScript, without giving up on Rails
Jonathan Johnson
 
Ad

Recently uploaded (20)

PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
Ad

第一次用 Vue.js 就愛上 [改]