Should the initialization of the vue component be called within the component or from the parent component?

  1. for example, there is a drop-down box component that needs to initialize its contents. There is an init method inside the component to get the content data.
Should

be called with $refs.xxx.init () on the parent component, or should the child component be called directly in created or mounted?
(if $refs.xxx.init () is called, you can know when the initialization ends with the parent component of the asynchronous function, and execute it directly in created, or you can let the parent component know that the initialization ends through the $emit custom event)

what are the advantages and disadvantages of the two?

  1. assume that in addition to the drop-down box component A, there is another B component in the parent component that also needs to be initialized. The parent component needs to wait for the two child components to be initialized for subsequent operations. If both An and B components are on the parent component (calling their respective init methods through $refs.xxx.init ()), it is easy to implement.

but if both are initialized on their respective created and thrown with $emit, how should the parent component tell that both child components are initialized?
(does the parent component define a counter to + 1 when an event is triggered? Then perform the follow-up operation at 2? )

I don"t know if there is something wrong with my way of thinking. Please correct


call

in the mounted in the subcomponent
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e812-19d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e812-19d8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?