mean.js菜单isPublic不工作 [英] mean.js menu isPublic not working

查看:107
本文介绍了mean.js菜单isPublic不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个mean.js应用程序,我想在用户登录和注销在顶部导航栏中,显示的菜单项。当用户登录,但是,当用户签署了未发生的菜单项显示。

In a mean.js app, I wanted to display the menu items in the top navbar while the user is signed in as well as signed out. The menu items are displaying while the user is signed in, however, that is not happening when the user is signed out.

在导航栏要显示的mean.js文档状态isPublic属性设置为true将允许菜单项,而用户签订的;但是这是行不通的。这里是code:

The mean.js docs state setting the 'isPublic' property to true will allow for the menu items to be shown on the navbar while user is signed out; but that is not working. Here is the code:

Menus.addMenuItem('顶栏','谈','会谈','下拉菜单','?/会谈(/创建),真正的);
  Menus.addSubMenuItem('顶栏','谈判','名单会谈','会谈');
  Menus.addSubMenuItem('顶栏','谈判','新谈,讲座/创建');

Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?', true); Menus.addSubMenuItem('topbar', 'talks', 'List Talks', 'talks'); Menus.addSubMenuItem('topbar', 'talks', 'New Talk', 'talks/create');

我看了一下,所有的解决方案建议的isPublic属性设置为true,但似乎是解决这个课题太大的混乱。任何人只要有答案?

The solutions I looked at, all suggest to set the isPublic property to true, but there seems to be too much confusion around this subject. Anyone with answers?

推荐答案

如果您在 menus.client.services.js 看在核心mean.js的模块的最后一行是这样的: this.addMenu('顶栏'); 。如果您将其更改为 this.addMenu('顶栏,真正的); 。你会看到显示在当你不登录的顶栏所有菜单项。然后你就可以在你的榜样或不添加菜单项,如真正因为它会

If you look in menus.client.services.js in the core module of mean.js the last line looks like this: this.addMenu('topbar');. If you change it to this.addMenu('topbar', true);. You will see all your menu items showing on the topbar when you aren't logged in. Then you can add your menu item like in your example or without the true as it will inherit it from the setting that was just changed:

Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?');
OR
Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?', true);

或者象下面这样,如果你现在想它隐藏时没有签署

Or like below if you now want it to hide when not signed in:

Menus.addMenuItem('topbar', 'Talks', 'talks', 'dropdown', '/talks(/create)?', false); 

我希望这有助于。

I hope this helps.

这篇关于mean.js菜单isPublic不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆