javascript - How to rerender a component in Vue -


i have sidebar consisted of 3 tabs:

home users list 

when click 'users' tab, router transition this:

this.$router.push('index/users') 

and users component rendered in:

<router-view></router-view> 

now want click users tab again in order fetch latest data.but component won't re-render again, , data doesn't refresh.

are there other ways can resolve instead of f5? hope works of components. ps: fetch data in lifecycle hook created().

i had same issue, solved watching router change in component "reload": https://router.vuejs.org/en/essentials/dynamic-matching.html

  watch: {       '$route': 'fetchdata'  // call function update data   }, 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -