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

     

    --------小尾巴 ________一个人欣赏-最后一朵颜色的消逝-忠诚于我的是·一颗叫做野的心.决不受人奴役.怒火中生的那一刻·终将结束...
  • 相关阅读:
    FTP-实例(Md5验证)
    Socket-实例
    函数对象、函数嵌套、名称空间与作用域、装饰器
    Docker——手动创建镜像
    Docker——桥接网络配置
    Docker——网络和存储(数据卷)
    Docker-PS命令解析
    面试题44:扑克牌的顺子
    面试题42:翻转单词顺序VS左旋转字符串
    面试题41:和为s的两个数字VS和为s的连续正数序列
  • 原文地址:https://www.cnblogs.com/tianxiaxuange/p/14416201.html
Copyright © 2011-2022 走看看