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="https://unpkg.com/vue">script>
div id="demo-app">
ul>
li v-for="customer in customers">
{{customer.id}} {{ customer.name }} and Age Are ({{customer.age}}) Years
li>
ul>
div>
VueJs Code –
//Model class
var customerModel = {
name: "Anil Singh",
age: 32,
customers: [
{ id:1, name: "code-sample.com", age: 5400 },
{ id:2, name: "code-sample.xyz", age: 4540 },
{ id:3, name: "code-view.com", age: 4520 }