英文:
Trouble Removing Login Button from Server Using MenuContributor in ABP Framework
问题
I understand your request. Here is the translated content:
有人知道如何从AuthServer中移除登录按钮吗?我以为它应该是MenuContributor的一部分,但它不是。
根据这份文档,我们可以使用Contributor添加菜单项:
https://docs.abp.io/en/abp/latest/UI/AspNetCore/Navigation-Menu
它可以正常工作,可以添加你想要的菜单项,但如果你想要移除一个,只有一个方法可用:
context.Menu.TryRemoveMenuItem("Login");
但这并不起作用,如果你查看菜单上的当前项,它只返回一个名为:
Abp.Application.Main.Administration
该菜单项在我的导航栏上不存在,登录或语言项也不在那里。
我该如何移除它们?
英文:
Does anyone know how to remove the login button from the AuthServer? I thought it would be part of the MenuContributor, but it's not.
It is weird because according to this doc, we can add a menu item with contributor:
https://docs.abp.io/en/abp/latest/UI/AspNetCore/Navigation-Menu
And it works; it adds the items you want, but if you want to remove one, there is only one method for that called:
context.Menu.TryRemoveMenuItem("Login");
That not works, but if you look at the current items on the menu, it only returns one item called:
Abp.Application.Main.Administration
That menu item does not exist on my navbar, and the login or language items are not there.
How can I remove them?
答案1
得分: 1
被标记的区域不是由菜单贡献者渲染的,而是由工具栏贡献者渲染的。您应该更新主工具栏。
这是文档链接: https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface#toolbar-contributors
或者,您可以重写UserLoginLink组件,该组件负责在工具栏中添加登录链接: https://github.com/abpframework/abp/blob/dev/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml
这是显示如何重写视图组件的文档链接: https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface#overriding-a-view-component
英文:
The marked area is not rendering from menu contributors. It comes from toolbar contributors. You should update the main toolbar.
Here is the documentation: https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface#toolbar-contributors
Alternatively, you can override the UserLoginLink component, which is responsible to add login link to toolbar: https://github.com/abpframework/abp/blob/dev/modules/account/src/Volo.Abp.Account.Web/Modules/Account/Components/Toolbar/UserLoginLink/Default.cshtml
Here is the documentation that show you how to override a view component: https://docs.abp.io/en/abp/latest/UI/AspNetCore/Customization-User-Interface#overriding-a-view-component
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论