Home / Snippets / Vue Js Call Watcher Immediately After Component Ready
Vue Js Call Watcher Immediately After Component Ready cover

Vue Js Call Watcher Immediately After Component Ready

161

2 years ago

0 comments

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
  }
}
notion avatar

Ahabz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

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

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this