CREATE Custom filters in Vue.js 2

What Is Vue.js 2 Lifecycle?

What Is Vuejs 2 Lifecycle?
ü  beforeCreate
ü  created
ü  beforeMount
ü  mounted
ü  beforeUpdate
ü  updated
ü  activated
ü  deactivated
ü  beforeDestroy
ü  destroyed

The beforeCreate () method is called synchronously after the VueJs instance has just been initialized.
The created () method is called synchronously after the VueJs instance is created.
The BeforeMount () method is called right before the component is mounted.
The Mounted () method is called after the component has just been mounted
The BeforeUpdate () method is method is called when the data changes, before the virtual DOM is re-rendered.
The Updated () method is called after a data change.
The Activated () method is called when a kept alive component is activated.
The Deactivated () method is called when a kept alive component is deactivated.
The BeforeDestroy () method is called right before a VueJs instantiated.
The Destroyed () method is called after a VueJs instance has been destroyed.

Examples -

How To CREATE Custom Filters in Vue.js 2?

HTML Code –
<script src=""></script>
<div id="demo-app">
    <li v-for="customer in customers">
      {{}} {{ }} and Age Are ({{customer.age}}) Years

VueJs Code –
//Model class
var customerModel = {
  name: "Anil Singh",
  age: 32,
  customers: [
    { id:1,  name: ""age: 5400 },
    { id:2name: ""age: 4540 },
    { id:3name: ""age: 4520 }

//Customer View Model.
var customerViewModel = new Vue({
    el: '#demo-app',
    data: customerModel

The result looks here –

How To Use filters in Vue.js 2?
HTML Code –
<script src=""></script>
<div id="demo-app">
  <label>Enter name </label>
  <input type="text" v-model="name" id="name" name="name" />
  <h4>My Name is - {{ name }} and my age is - {{ age }} years. </h4>

VueJs Code –
//Model class
var userModel = {
  name: "Anil Singh",
  age: 24

//View Model Class
var userViewModel = new Vue({
  el: '#demo-app',
  data: userModel

Result looks here -

I hope you are enjoying with this post! Please share with you friends. Thank you!!

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog -
My Books - Book 1 and Book 2 Powered by Blogger.