I have a component that contains router-links to the same route, but with a different parameter. When navigating to those links, the url changes but the data isn't updating. I have beforeRouteUpdate defined, but it is never called.
import Vue from 'vue';
import { Component } from 'vue-property-decorator';
@Component
export default class AccountComponent extends Vue {
address: string;
account: Account;
data() {
return {
account: null
}
}
beforeRouteUpdate(to: any, from: any, next: any) {
console.log('beforeRouteUpdate for ' + to.params.address);
next();
}
mounted() {
this.address = this.$route.params.address;
this.loadData();
}
loadData() {
console.log('Fetching data for ' + this.address);
fetch('api/Account/Get?address=' + this.address)
.then(response => response.json() as Promise<Account>)
.then(data => {
this.account = data;
});
}
}