zoukankan      html  css  js  c++  java
  • 【angular2】@angula/cdk/platform 学习03

    1. cdk 文档 https://material.angular.io/cdk/categories

    2. platform 模块提供获取平台信息,以及平台支持的功能

    (1)在使用之前的先import PlatformModule模块到我们工程里面来(这也是使用cdk里面Platform里面功能的前提),比如咱们可以在app.module.ts文件里面引入。引入方式如下:

    • import { PlatformModule } from '@angular/cdk/platform';
      
      @NgModule({
          ...
          imports: [
              ...,
              PlatformModule,
              ...
          ],
          ...
      })
      export class AppModule {
      }

    (2)有一个 Service

    Platform 类,用法也是非常的简单,就一些属性的使用。属性解释如下:

    • Platform类属性类型解释
      ANDROID boolean 当前平台是否android系统
      IOS boolean 当前平台是否IOS系统
      isBrowser boolean 当前平台是否浏览器
      EDGE boolean 当前平台是否edge浏览器
      FIREFOX boolean 当前平台是否firefox浏览器
      SAFARI boolean 当前平台是否safari浏览器
      TRIDENT boolean 当前平台浏览器的render engine是否为Microsoft Trident
      WEBKIT boolean 当前平台浏览器的render engine是否为Webkit
      BLINK boolean 当前平台浏览器的render engine是否为Blink

    (3)提供的功能点

    功能点Platform模块方法参数返回值解释
    01 getSupportedInputTypes Set 当前浏览器支持的输入类型(比如 text, date, number, tel 等)
    02 supportsPassiveEventListeners boolean 当前浏览器是否支持被动事件监听器
    03 normalizePassiveListenerOptions AddEventListenerOptions AddEventListenerOptions 或者 boolean 兼容各种浏览器 AddEventListener 的 options 处理
    04 supportsScrollBehavior boolean 当前浏览器是否支持滑动行为
    05 getRtlScrollAxisType RtlScrollAxisType

    获取当前浏览器使用的RTL滚动轴的类型(export const enum RtlScrollAxisType

    Chrome的是NORMAL, Firefox和 Safari的是NEGATED, IE和Edge的是INVERTED.)

    06 _supportsShadowDom boolean 当前浏览器是否支持 ShadowDom
    07 _getShadowRoot element: HTMLElement ShadowRoot | null 获取 元素element 的 ShadowDom

     

    --------小尾巴 ________一个人欣赏-最后一朵颜色的消逝-忠诚于我的是·一颗叫做野的心.决不受人奴役.怒火中生的那一刻·终将结束...
  • 相关阅读:
    关于C#中Environment.OSVersion判断操作系统及Win10上的问题
    C#各种数组直接的数据复制/转换
    移位操作<<和>>,是逻辑数字上的移动(和大端小端无关)
    log4net学习笔记
    链接错误——无法解析的外部符号 ConvertStringToBST
    当Thread.Sleep的暂停时间参数设置过小时,精度很差的解决方法
    Python发送邮件
    Python使用HTMLTestRunner运行所有用例并产生报告
    pandas学习笔记
    Python requests模块做接口测试
  • 原文地址:https://www.cnblogs.com/tianxiaxuange/p/14416201.html
Copyright © 2011-2022 走看看