myesn

myEsn2E9

hi
github

ABP: UserMenu 新增菜单项

image

方法#

打开 Web 项目的 Menus\?MenuContributor,加入以下代码:

    public async Task ConfigureMenuAsync(MenuConfigurationContext context)
    {
        ..

        if (context.Menu.Name == StandardMenus.User)
        {
            await ConfigureUserMenuAsync(context);
        }
    }

    private Task ConfigureUserMenuAsync(MenuConfigurationContext context)
    {
        context.Menu.Items.Insert(
          1,
          new ApplicationMenuItem(
              ?Menus.Subscription,
              "购买套餐",
              url: "/Account/Subscription",
              icon: "fas fa-home",
              order: 1001 // 因为“我的账号”序号是1000
          ).RequirePermissions(?Permissions.?.PersonalCenter.SubscriptionPage.Default)
        );

        return Task.CompletedTask;
    }    

参考#

https://abp.io/docs/latest/framework/ui/mvc-razor-pages/navigation-menu#standard-menus

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.