當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript MatSidenav.close方法代碼示例

本文整理匯總了TypeScript中@angular/material.MatSidenav.close方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript MatSidenav.close方法的具體用法?TypeScript MatSidenav.close怎麽用?TypeScript MatSidenav.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/material.MatSidenav的用法示例。


在下文中一共展示了MatSidenav.close方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: swipe

    /**
     * Handle swipes and gestures
     */
    public swipe(e: TouchEvent, when: string): void {
        const coord: [number, number] = [e.changedTouches[0].pageX, e.changedTouches[0].pageY];
        const time = new Date().getTime();

        if (when === 'start') {
            this.swipeCoord = coord;
            this.swipeTime = time;
        } else if (when === 'end') {
            const direction = [coord[0] - this.swipeCoord[0], coord[1] - this.swipeCoord[1]];
            const duration = time - this.swipeTime;
            if (
                duration < 1000 &&
                Math.abs(direction[0]) > 30 && // swipe length to be detected
                Math.abs(direction[0]) > Math.abs(direction[1] * 3) // 30° should be "horizontal enough"
            ) {
                // definition of a "swipe right" gesture to move in the navigation
                // only works in the far left edge of the screen
                if (
                    direction[0] > 0 && // swipe left to right
                    this.swipeCoord[0] < 20
                ) {
                    this.sideNav.open();
                }

                // definition of a "swipe left" gesture to remove the navigation
                // should only work in mobile mode to prevent unwanted closing of the nav
                // works anywhere on the screen
                if (
                    direction[0] < 0 && // swipe left to right
                    this.vp.isMobile
                ) {
                    this.sideNav.close();
                }
            }
        }
    }
開發者ID:jwinzer,項目名稱:OpenSlides,代碼行數:39,代碼來源:site.component.ts

示例2:

 this.authService.authStatus.subscribe(authStatus => {
   if (!authStatus.isAuthenticated) {
     this.sideNav.close()
   }
 })
開發者ID:ershad1,項目名稱:lemon-mart-1,代碼行數:5,代碼來源:app.component.ts

示例3: mobileAutoCloseNav

 /**
  * Automatically close the navigation in while navigating in mobile mode
  */
 public mobileAutoCloseNav(): void {
     if (this.vp.isMobile) {
         this.sideNav.close();
     }
 }
開發者ID:jwinzer,項目名稱:OpenSlides,代碼行數:8,代碼來源:site.component.ts

示例4: close

 /**
  * Close this sidenav, and return a Promise that will resolve when it's fully closed (or get rejected if it didn't).
  *
  * @returns Promise<MatSidnavToggleResult>
  */
 public close(): Promise<MatDrawerToggleResult> {
   this.sidenav.close();
   return;
 }
開發者ID:idealhack,項目名稱:gocryptotrader,代碼行數:9,代碼來源:sidebar.service.ts

示例5: close

 public close() {
   return this.sidenav.close();
 }
開發者ID:Dardym,項目名稱:RepriseOrdi,代碼行數:3,代碼來源:sidenav.service.ts

示例6:

 .subscribe(() => this.sidenav.close());
開發者ID:sinedied,項目名稱:sk-angular2,代碼行數:1,代碼來源:__material-simple.shell.component.ts


注:本文中的@angular/material.MatSidenav.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。