【问题标题】:Angular material doesn't dialog scroll角材料不对话框滚动
【发布时间】:2020-04-24 15:37:16
【问题描述】:

我使用包含数字输入的材料对话框。在移动视图中,当键盘打开时我无法滚动对话框内容,所以我看不到输入的数字。我该怎么办?

数字输入在键盘下方, 我看不出可以输入什么。请帮帮我

【问题讨论】:

  • 您如何为 Android 编译您的项目,您使用的是哪种键盘,本机键盘还是自定义键盘?
  • 我不编译。它只是用纯 CSS 响应的。我只是用角度和纯CSS来响应它
  • 好吧,如果你的键盘有绝对位置,那么它肯定不会滚动,但这与材质对话框和滚动无关。您需要为您的实现提供一些代码。
  • 我没有将位置添加到键盘的默认手机模式

标签: angular angular-material responsive


【解决方案1】:
.cdk-global-overlay-wrapper {
  pointer-events: auto !important; // be able to scroll event
  overflow-y: scroll !important;
  align-items: start !important;  // not center the dialog
  z-index: auto !important; // remove z-index
}
.cdk-overlay-pane {
  margin: 1rem; //enter code here
  z-index: 1002; // over the overlay
}

【讨论】:

    【解决方案2】:

    我通过在材质对话框打开时添加一些类解决了这个问题

    html

    <div class="parent-container" [class.noscroll]="openOverlay == true">
       ...........
    </div>
    

    css

    .noscroll {
      position: fixed;
      overflow: hidden;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-17
      • 2023-03-10
      • 2021-11-27
      • 1970-01-01
      • 2021-10-08
      • 2018-11-14
      • 2020-11-19
      • 2018-06-17
      相关资源
      最近更新 更多