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
Post a Comment