Слайд 2
Introduction
Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces.
Following are
the features available with VueJS:
Virtual DOM
Event Handling
Data Binding
Components
Computed Properties
Watchers
Note:
Vue does not support IE8 and below
Latest stable version: 2.6.10
$ npm install vue
$ bower install vue
Слайд 3
Vue Instance
Contains:
Element
Data
Methods
Filters
Watchers
Lifecycle hooks
Computed properties
To start with VueJS, we need to create
the instance of Vue, which is called the root Vue Instance.
The Vue instance is a JavaScript object.
The visible part of a Vue.js application is typically rendered via Vue.js directives.
Слайд 4
Слайд 5
Form binding
Directives: v-bind, v-model
v-model internally uses different properties and emits different
events for different input elements:
text and textarea elements use value property and input event;
checkboxes and radiobuttons use checked property and change event;
select fields use value as a prop and change as an event.
Слайд 6
Class and Style Bindings
Directives:
v-bind:class
v-bind:style
Слайд 7
Events
Directive: v-on
Pass event as a parameter with $event
Event listeners:
click
dblclick
keyup
keydown
change
input
Modifiers:
.stop
.prevent
.capture
.self
.once
.passive
Слайд 8
List Rendering
Mapping an Array
Mapping an Object
Directive:v-for
Слайд 9
Computed and Watched Properties
Computed:
Cached based on their reactive dependencies
Re-evaluates only if
some of its reactive dependencies changes
By default getter-only
Setter can be provided
Watchers:
Way to observe and react to data changes
Слайд 10
Conditional rendering
Directives:
v-if
v-else
v-else-if
v-show
Usage:
Used to conditionally render a block.
v-if ensures that event listeners
and child components inside the conditional block are properly destroyed and re-created during toggles.
v-show toggles the display CSS property of the element