Data Is Vanished In Next Line
Can anyone please explain me what is happened in these codes and how can I solve it? I get the data in the parent's mounted function and update its data. So I have the new object i
Solution 1:
The child-component is mounted but the parent fetch is not finished yet, so this.config
is an observer until the fetch is done (so the then
is fired) and the var fulfilled.
Can you try to watch the prop config
in the child-component? then you will see when this.config
is fulfilled.
https://vuejs.org/v2/guide/computed.html#Watchers
UPDATE WITH EXAMPLE:
child-component
watch: {
config(newValue) {
console.log("AA==============>", newValue.intranetEditions);
checkConfigValue();
},
},
methods: {
checkConfigValue() {
console.log("BB==============>", this.config.intranetEditions);
};
},
So you can wether do something in the watcher with the newValue
, or trigger a method and use this.config
. Both consoles, will print the same in this case.
Post a Comment for "Data Is Vanished In Next Line"