首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >角材料导航示意图断点

角材料导航示意图断点
EN

Stack Overflow用户
提问于 2018-11-06 04:27:00
回答 1查看 1.6K关注 0票数 1

我正在尝试使用“角/材料:角材料指南”中的nav示意图。

代码语言:javascript
复制
ng generate @angular/material:nav <component-name>

在模板中,sidenav显示在大屏幕设备上,然后在不到960px时变成一个汉堡包菜单。

960px或以上

小于960px

有人知道这是怎么安排的吗?例如,我想要大屏幕设备上的汉堡包菜单?

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-11-10 20:55:06

断点在常量中指定。

代码语言:javascript
复制
export const Breakpoints = {
  XSmall: '(max-width: 599.99px)',
  Small: '(min-width: 600px) and (max-width: 959.99px)',
  Medium: '(min-width: 960px) and (max-width: 1279.99px)',
  Large: '(min-width: 1280px) and (max-width: 1919.99px)',
  XLarge: '(min-width: 1920px)',

  Handset: '(max-width: 599.99px) and (orientation: portrait), ' +
           '(max-width: 959.99px) and (orientation: landscape)',
  Tablet: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait), ' +
          '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',
  Web: '(min-width: 840px) and (orientation: portrait), ' +
       '(min-width: 1280px) and (orientation: landscape)',

  HandsetPortrait: '(max-width: 599.99px) and (orientation: portrait)',
  TabletPortrait: '(min-width: 600px) and (max-width: 839.99px) and (orientation: portrait)',
  WebPortrait: '(min-width: 840px) and (orientation: portrait)',

  HandsetLandscape: '(max-width: 959.99px) and (orientation: landscape)',
  TabletLandscape: '(min-width: 960px) and (max-width: 1279.99px) and (orientation: landscape)',
  WebLandscape: '(min-width: 1280px) and (orientation: landscape)',
};

现在您可以更改或自定义断点。例如:

代码语言:javascript
复制
isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
代码语言:javascript
复制
isTablet$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Tablet)
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53165736

复制
相关文章

相似问题

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