Posts Learn Components Snippets Categories Tags Tools 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

135 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
  }
}

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

)