当前位置:网站首页>Nesting and splitting of components

Nesting and splitting of components

2022-07-07 07:09:00 To be a woman of light

If we have an application Put all the logic in one component in , Then the component will become this Very bloated and very difficult to maintain ;

So the core idea of componentization should be Split components , Split into Small components ;

stay Group and Nest these components together , To form Our app ;

1. Pay attention to vscode Write in it .vue When you file ,vscode It doesn't support itself , All the code written in this is not highlighted

Official plug-in recommendation :Vetur This plugin ( Highlight tips )

 Vu3 Snippets Code snippet generation ( Improve development efficiency )

 App.vue Write... In the file :

If you want to App.vue Want to use other components , There are two ways :

  1. All registered as global components ( Don't suggest : Once the global component is registered, it will not be destroyed , This wastes performance )
  2. Partial registration , Which component is used for registration .

原网站

版权声明
本文为[To be a woman of light]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070312312275.html