How should the component VUE be split?

for example, a Weibo message I split into these three sub-components (avatar, username time, content) is that right? Or is there another way

consolo.log
Apr.11,2021

Let me help you sort it out

if you have split in this way

then according to the function of the page, is there any communication between components (father and son, brothers)
if so, you divide the components into sibling components and parent-child components
then is it convenient to communicate, and is it better that some sibling components can be converted into parent-child components? And vice versa

Has the code readability of

components been improved? Sometimes dividing too many components reduces readability


just one file directly. The reason for breaking it into your size can only be that you have other places that will separately use one or more of these files. If you don't need it, please directly use a component and don't disassemble it, otherwise you will know how difficult and painful it is to maintain it.


if it were me, I would treat this whole block as a component.


Let's take a whole piece as a component. If you need to use one of the three sub-components separately elsewhere, consider splitting them. Otherwise, there is no need for


this piece to be a component.
if I cycle through the component directly, I have to pass a value
I feel that it is meaningless to split this piece in order to split


this piece is just a file, ah, there is no need to split, and then split is really excessive split, personal feeling is really not necessary.

if you like the feeling of stacking blocks, feel free to open them! But in general, it is best to deal with


a component

Menu