File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
packages/theme/layout-default Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ import { BreakpointObserver } from '@angular/cdk/layout' ;
1
2
import { Injectable , inject } from '@angular/core' ;
3
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop' ;
2
4
import { BehaviorSubject , Observable } from 'rxjs' ;
3
5
4
6
import { SettingsService } from '@delon/theme' ;
@@ -38,6 +40,18 @@ export class LayoutDefaultService {
38
40
return `menu-${ type } ` ;
39
41
}
40
42
43
+ constructor ( bm : BreakpointObserver ) {
44
+ const mobileMedia = 'only screen and (max-width: 767.99px)' ;
45
+ bm . observe ( mobileMedia )
46
+ . pipe ( takeUntilDestroyed ( ) )
47
+ . subscribe ( state => this . checkMedia ( state . matches ) ) ;
48
+ this . checkMedia ( bm . isMatched ( mobileMedia ) ) ;
49
+ }
50
+
51
+ private checkMedia ( value : boolean ) : void {
52
+ this . settings . setLayout ( 'collapsed' , value ) ;
53
+ }
54
+
41
55
private notify ( ) : void {
42
56
this . _options$ . next ( this . _options ) ;
43
57
}
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ export class DevLayoutComponent implements OnInit {
119
119
logoExpanded : `./assets/logo-full.svg` ,
120
120
logoCollapsed : `./assets/logo.svg` ,
121
121
hideHeader : false ,
122
- showHeaderCollapse : false ,
122
+ showHeaderCollapse : true ,
123
123
showSiderCollapse : true
124
124
// hideAside: true
125
125
} ;
You can’t perform that action at this time.
0 commit comments