Vue questions about the parent component of the acquired data to the asynchronous sub-assemblies

Since the data in the parent component is acquired asynchronously, and sub-assemblies will be rendered in the beginning, it will cause the situation after sub-component rendering is complete, the data has not been acquired

Here's a simple solution: Before rendering sub-assemblies, parent component data to determine whether the acquisition is completed, the data obtained after the completion of rendering sub-assemblies

tab-weekly(v-if="userId", :userId="userId")

As the code, sub-assembly is tab-weekly, userId asynchronous acquired within parent components, the data to be passed to the sub-assembly tab-weekly, in which a judgment added, userId when present, and then rendering subassembly

 

Guess you like

Origin www.cnblogs.com/jane2160/p/11322165.html