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

     

    --------小尾巴 ________一个人欣赏-最后一朵颜色的消逝-忠诚于我的是·一颗叫做野的心.决不受人奴役.怒火中生的那一刻·终将结束...
  • 相关阅读:
    String方法
    多态
    观察者模式
    ArrayList和LinkList
    唐岛湾
    AForge.Net C#的操作视频,照片读写功能
    JqGrid填坑
    日常点滴
    日常点滴
    EF Core 填坑记录
  • 原文地址:https://www.cnblogs.com/tianxiaxuange/p/14416201.html
Copyright © 2011-2022 走看看