0👍
Only your user
is a computed property, and you are only calling to concatenate the user name and lastname in mounted
. When mounted has been run, it is never called again. Therefore it works when you set a timeout, the user has then had time to be fetched from the store and can be displayed. You can use watch
to listen to changes in the user
and then set the value. As your form is an object, we need to listen deep
and maybe you need to use immediate
as well. So add a watcher:
watch: {
user: {
immediate:true,
deep: true,
handler(user) {
this.$set(this.form, 'responsible_clerk', user.name + " " + user.lastname);
}
}
}
- [Vuejs]-Vue dynamic import is being imported even if it is never used
- [Vuejs]-Bootstrap Navbar Doesn't Appear Properly in my Vue js App
Source:stackexchange.com