问题
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 minemasthead
- 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