0👍
Try to make your created
as a watch
Something like:
watch: {
'$route.params.searchTags': {
deep: true,
immediate: true, // this triggers the watch on component creation, so you can remove the created hook content
handler() {
if (!this.$route.params.searchTags) {
this.getPosts(this.apiUrl);
} else {
this.getPostByTags('/getPostByTags', this.$route.params.searchTags);
}
}
}
}
- [Vuejs]-Vue.js Show most recent unique entries
- [Vuejs]-Vue app with .NET core backend api with Areas, using webpack, Vue is not loading
Source:stackexchange.com