Posts Learn Components Snippets Categories Tags About
/

Vue Js Call Watcher Immediately After Component Ready

Learn how to call watcher immediately after the component is ready in Vue Js

Created on Sep 11, 2021

8 views

Sometimes you might need to call Vue Js watcher immediately after the component is ready and to do that you can specify the "immediate" property to "true" to the watcher method.
watch: {
  searchText: {
    handler: 'fetchPostList',
    immediate: true
  }
},

methods: {
  fetchPostList () {
    // ajax call to fetch post list
  }
}

Snippets by

PostSrc poster

PostSrc

Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components

Other Code Snippets

More