javascript - How to split components reasonably in vue? What kind of module should be a separate component?
学习ing
学习ing 2017-06-12 09:32:33
0
1
578

Recently I am writing a small web chat application, with a main interface and a chat page. The content is not complicated. The first time I tried to write with Vue, I divided the personal information at the head of the main interface, the list in the middle, the friend category switching at the bottom, and the text of the chat interface opened by clicking on the list item, the message panel, etc., all into separate components.
But this seems to cause more child-parent component communication. The leader said that I don’t need to write these in separate components. The idea of components is reuse, but I don’t need to reuse these. But when I look at demos on the Internet, different functional modules are separated into individual components.


So I hope you can help me figure out the logic, how to optimize the component segmentation of this chat function, and how to understand the idea of component reuse?

学习ing
学习ing

reply all (1)
学霸

My understanding is that since it is written as a component, it means that this component will be used in other places. Otherwise, there is no point in taking it out and it will cause more trouble for yourself. If you think the page has a lot of content, you can extract the css and js to write.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!