class: center, middle
logo
# VueJS Essentials --- class: center, middle # Über Mich
## Alexander Heimbuch [@zusatzstoff](https://twitter.com/zusatzstoff)
[alexander.heimbu.ch](https://alexander.heimbu.ch)
[github.com/alexander-heimbuch](https://github.com/alexander-heimbuch) --- # Agenda 1. Adoption 2. Kernkonzept 3. Beispiel Projekt 4. Installation 5. Vue Komponenten 6. Direktiven, Mixins & Plugins --- class: center, middle # 1. Adoption
??? - Entwickelt von Evan You - 114k Github Stars - Äußerst beliebt in China - Adaption steigend, hauptsächlich wegen des pragmatischen Entwicklungsansatzes --- class: center, middle # 2. Kernkonzept
??? - VueJS ist ein einfacher und flexibler view layer - Fokus auf Komposition und Funktionalität - Kann für kleine Projekte verwendet werden gibt aber die Möglichkeit zu skalieren - Verbindet die View mit einem Model mittels 2way Databinding - API ist stark beeinflusst durch AngularJS und KnockoutJS --- class: center, middle # 2. Kernkonzept
??? - Können mehrere Vue Instanzen auf einer Seite existieren - Eine Instanz teilt sich in einen Komponenten Baum auf, der wiederum einzelen Vue Instanzen enthält - ViewModel // var vm = new Vue({ /* options */ }) - View // vm.$el - Model // vm.$data --- class: center, middle # 3. Beispiel Projekt --- class: middle # 4. Installation ```bash $ npm install -g @vue/cli $ vue create example-app $ yarn serve ``` ??? - VueCLI - Devtools --- class: center, middle # 5. Vue Komponenten ??? - Script Type - Style Type - empty project - yarn add node-sass sass-loader --dev - yarn add normalize-scss --- class: middle # Template Syntax ```javascript
Hello {{ myVar }}
{{ `Interpolate ${ myVar2 }` }}
In case {{ conditionVar }} is 2
If {{ conditionVar }} is not 2
{{ message | capitilizeFilter }}
``` ??? - Mustache Bindings - Afterwards parsed to a virtual dom function - template can be also defined with a render function - Can only have one root node - Create cards component - Create styles - Import movie data - Render Cards --- class: center, middle # Komponenten Kommunikation
??? - Cards View Component - Card Component - Poster prop - Search Toggle - Search Input - Event Emitting (@load, @error) --- class: center, middle # Data Binding
??? - Reactive Databindings - ES5 DefineProperty Magic - Search String Example - Limitations in Arrays, deep nested Objects --- class: center, middle # Computed and Watch Properties ??? - Filter list of movies - Move data to App root - Use watch to filter the results - Use a computed result of multiple properties - Filter property - Reset search --- class: center, middle # Komposition ??? - Slots - Higher Order Components - Icons Refactor - Generic Icon Component --- class: center, middle # 6. Direktiven & Filter ??? - Search focus - Advanced key handlings - @keyup.esc and @keyup.enter - Uppercase filter