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!!

Hey! I'm Anil Singh. I author this blog. I'm Active Blogger, Programmer. I love learning new technologies, programming, blogging and participating the forum discussions more...
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
Post a Comment Powered by Blogger.
ASK Questions