Sails.js- how to move the Top nav to a component?

夙愿已清 提交于 2019-12-14 03:04:25

问题


I needed a top-nav with a good amount of extras and flexabliltiy. I also didnt want my layout.ejs to become a tangled mess. So I moved my top-nav into a component and wanted to share how I did it here.


回答1:


  • Create a new component in assest/js/components/ (I look at the existing components that come with the Sails app for reference) I named mine masthead
  • Built my nav-bar in the component
  • Removed any mention of the top-nav in layout.ejs
  • Added <masthead></masthead> to all HTML files that will have this top-nav

This also has the added benefit of being able to get your Sails_Locals on to your nav-bar.




回答2:


@Raqem maybe you could write one for how to use a Vue plugin in Parasails :-)



来源:https://stackoverflow.com/questions/55010131/sails-js-how-to-move-the-top-nav-to-a-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!