Learn Vue.Js - SkillBakery Studios


Post Top Ad

Post Top Ad

Monday, August 31, 2020

Learn Vue.Js

From many popular front end frameworks used by developers.Vue.js is a front-end framework that aims to combine the best aspects of these frameworks. Vue.js is a progressive javascript framework approachable and versatile.

Vue.js is developed by “Evan You”.vue is a progressive framework for building user interface unlike another monolithic framework,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 or existing projects.

What you need to know before you start?

Intermediate level of knowledge of HTML, CSS, and Javascript.

If you are totally new to frontend development I would recommend getting your hand on the basics of javascript.

How to construct component and nested component, how vue reactively keeps the DOM up-to-date when data is change.

Core concept of Vue.JS

·       Template syntax

·       Computed properties and watchers

·       Class and style binding

·       Conditioning Rendering

·       List Rendering

·       Event handling

·       Form input-binding

·       Routing state management

·       Rendering

·       Custom Directive

 Let's get started with the installation

·       How to install local web server for a visual studio code editor

·       How to install Vue JS


Core concepts of Vue.Js

Template Syntax –vue.js uses an HTML based template syntax that allows you to declaratively bind the rendered DOM to the underlying vue instance data.

Interpolations – Most basic form of data binding is text interpolation using “Mustactic” syntax

<span>Message :{{msg}}</span>

 Events &Methods in VueJS

Why to use Vue?

·       Extremely fast & lightweight

·       Less learning curve than other frameworks

·       Build powerful SPA Apps

·       Virtual DOM

·       Growing in industry

Reusable Components




Export default{












font size :4rem;







<div class =”user”>







·       This is a beautiful tool to generate and build Vue App.

·       Features include typescript, babel, or more.

·       Includes vue UI tool to manage your app in a graphical interface.

Computed properties and watchers

Expressions are very convenient, they are meant for simple operations.


For e.g.

<div id =”msgexample”>



The template is no longer simple and declarative

<div id=”example”>

<p>original :”{{message}}”</p>

<p>Computed reverse message: “{{reversedMessages}}”</p>



Javascript Code


Var x= new vue({



Message: ‘Hello’




return this.message.split(‘’).reverse().join(‘’)








Value of the reversed message is always depend on the message property hence

Vm.reversedMessage always changes with changes to Vm.message.

 Computed Coaching VS Method



<p>Reversed Message :”{{reversedMessage()}}”</p>


//in comment

Method :{

reversedMessage : function(){

return this.message.split(‘’).reverse().join(‘’)




In this method to achieve the same result as a computed property. A computed property will re-evaluate only when some of its reactive dependencies change, thus multiple access to the reversedMessage will return compiled results without running the function again.

 Computed Vs Watched Property

Vue provides a watch property that is a more generic way to observe and rest to data changes on the vue instance.



<div id =”demo”>{{fullName}}</div>


Var a = new vue ({

El: ‘#demo’;


firstName : ‘Bhawna’,

LastName :’Tiwari’

fullName :’Bhawna Tiwari


Watch :{





this.fullName=this.firstName+’ ‘ +val





Computed Property


var a = new vue({

el: ‘#demo’,


firstName : ‘Bhawna’

lastName : ‘Tiwari’




return this.firstName+’ ‘ +this.lastName





Computed Setter

Computed properties are by default getter only you can provide a setter when needed





return this.firstName+’ ‘+ this.lastName



var names= newValue.split(‘ ‘)


This.lastName= names[names.length-1]






Computed properties are more appropriate in many cases, this is the reason Vue provides us with the watch option


<div id= “watch-example”>

 Class and style binding:

Common need foe data binding is manipulating an elements class list and inline styles. Vue provides a special enhancements when v-bind is used with class and style.

 Object syntax

<div v-bind :class= “{active “ isActive}’></div>

Presence of the active class will be determined by the truthiness of the data property isActive.


<div class = “static” v-bind:class=”{active:isActive,’text-danger’:hasError}’></div>

And following the data


isActive :true



It will render

<div class =”static active”></div>


Array Syntax


We can pass an array to v-bind:class

<div v-bind:class =”[activeClass,errorClass]”</div>

Data :{

activeClass : ‘active’,

errorClass : ‘text-danger’


 Which will render

<div class =”active text-danger”></div>

If you like to toggle a class in the list conditionally you can use a ternary expression

<div v-bind:class =”[isActive ?activeClass:”,errorClass]”></div>


This always applies errorClass , only if isActive is true.when you use the class attribute on a custom component, those classes will be added to the components root element.

For e.g

Declaring this component

vue.Component(my-component’{Template:<p class =”chocolate”>Hi</p>


 Conditional Rendering

The declarative v-if is used to conditionally render a block.This will rendered when expression return a true value.


<h1 v-if=”awesome”>Vue is awesome!</h1>

We can add “else block” with v-else:

<h1 v-if=”awesome”>Vue is awesome!</h1>

<h1 v-else>Not good </h1>


Conditional groups with v-if on <template>

v-if is a directive, it is attached to a single element.if we want to toggle more than one element?


<template v-if =”ok”>





<div v-if =”Math.random()>1”>

Look at this


<div v-else>

Look at that


v-else element immediately follow

v-if or a v-else-if element otherwise


v-else-if,as name suggest works as “else if block”

for v-if

<div v-if=”type === ‘1’”>



<div v-else-if =”type ===’2’”>



<div  v-else>




List Rendering

Mapping an array to elements with V-for

We use v-for directive to render a list of an array.This v-for requires a syntax in the form of items,where items is the source data array.


<u1 id =”Number-1”>

<li v-for=”List of items”: key =”item.message”>

{{ item.message }}



Var number 1 =new Vue({

e1: ‘number-1’,

data : {

items :[

{ message : ‘chocolate’},

{message : ‘candy’}






·        Chocolate

·        Candy

These are the few concepts including example vue.js.

let's dig and explore more on this through our website with details of this course.


No comments:

Post a Comment

Post Top Ad