首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在nebular开发的ngx-admin中将侧边栏更改为右侧

在nebular开发的ngx-admin中将侧边栏更改为右侧
EN

Stack Overflow用户
提问于 2019-09-02 15:22:43
回答 4查看 3.4K关注 0票数 2

我必须将ngx-admin设置为RTL样式。我必须把侧边栏设置好。经过一些研究,在这个Github项目中没有找到任何解决方案。任何人都可以帮助我解决这个问题。

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2019-09-03 15:29:46

将file one- Change .layout.scss更改为

代码语言:javascript
运行
复制
@import '../../styles/themes';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/breakpoints';

@include nb-install-component() {
  .menu-sidebar ::ng-deep .scrollable {
    padding-top: nb-theme(layout-padding-top);




  }

  .menu-sidebar-rtl{
    order: 0 !important;
  }

  .menu-sidebar{
    order: 2 !important;
  }

}

并将文件one- change .layout.ts更改为

代码语言:javascript
运行
复制
import {Component, OnInit} from '@angular/core';
import {NbLayoutDirection, NbLayoutDirectionService} from "@nebular/theme";

@Component({
  selector: 'ngx-one-column-layout',
  styleUrls: ['./one-column.layout.scss'],
  template: `
    <nb-layout windowMode>
      <nb-layout-header fixed>
        <ngx-header></ngx-header>
      </nb-layout-header>

      <nb-sidebar [ngClass]="sidebar_class" tag="menu-sidebar" responsive>
        <ng-content select="nb-menu"></ng-content>
      </nb-sidebar>

      <nb-layout-column>
        <ng-content select="router-outlet"></ng-content>
      </nb-layout-column>

      <nb-layout-footer fixed>
        <ngx-footer></ngx-footer>
      </nb-layout-footer>
    </nb-layout>
  `,
})
export class OneColumnLayoutComponent implements OnInit {
  constructor(private  directionService: NbLayoutDirectionService) {
  }

  ngOnInit(): void {
    if ( this.layout_direction === NbLayoutDirection.RTL) {
      this.sidebar_class = 'menu-sidebar-rtl';
    }
  }

  layout_direction: NbLayoutDirection = this.directionService.getDirection();
  sidebar_class: string = 'menu-sidebar';
}
票数 1
EN

Stack Overflow用户

发布于 2020-11-08 01:19:45

你应该做两件事:

1-在theme.module.ts中:

代码语言:javascript
运行
复制
    export class ThemeModule {
  static forRoot(): ModuleWithProviders<ThemeModule> {
    return {
      ngModule: ThemeModule,
      providers: [
        ...NbThemeModule.forRoot(
          {
            name: "default",
          },
          [DEFAULT_THEME, COSMIC_THEME, CORPORATE_THEME, DARK_THEME],
          DEFAULT_MEDIA_BREAKPOINTS,

          NbLayoutDirection.RTL
        ).providers,
      ],
    };
  }
}

我们添加:

代码语言:javascript
运行
复制
   DEFAULT_MEDIA_BREAKPOINTS,
   NbLayoutDirection.RTL

2-对于侧边栏,将"start“添加到:

代码语言:javascript
运行
复制
  <nb-sidebar class="menu-sidebar" tag="menu-sidebar" responsive start>
    <ng-content select="nb-menu"></ng-content>
  </nb-sidebar>
票数 3
EN

Stack Overflow用户

发布于 2021-06-16 13:22:27

你所需要做的就是在标签上添加“正确”的单词:

代码语言:javascript
运行
复制
<nb-sidebar state='collapsed' right class="menu-sidebar" tag="menu-sidebar" responsive end>
</nb-sidebar>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57752857

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档