我正在尝试将滑动手势集成到 Angular 材料 2(Angular5) 中。它在桌面上使用鼠标工作。问题是,当我使用移动设备(Chrome)时,它只感知选项卡标签上的手势。
模板代码:
<mat-tab-group mat-scroll-y (swipeleft)="swipe($event.type)" (swiperight)="swipe($event.type)" class="home-tabs" mat-stretch-tabs [(selectedIndex)]="selectedIndex">
<mat-tab label="Home">
<ng-template mat-tab-label>
<mat-icon>home</mat-icon>
</ng-template>
<app-my-cars></app-my-cars>
</mat-tab>
<mat-tab label="Registered Cars">
<ng-template mat-tab-label>
<mat-icon>directions_car</mat-icon>
</ng-template>
<app-registered-cars></app-registered-cars>
</mat-tab>
<mat-tab label="Unregistered Cars">
<ng-template mat-tab-label>
<mat-icon>directions_car</mat-icon>
</ng-template>
<app-unregistered-cars></app-unregistered-cars>
</mat-tab>
</mat-tab-group>
Run Code Online (Sandbox Code Playgroud)
组件代码:
export class DashboardHomeComponent implements OnInit {
constructor() { }
ngOnInit() {
}
selectedIndex: number = 0;
totalTabs: number = 3;
SWIPE_ACTION = { LEFT: 'swipeleft', RIGHT: 'swiperight' };
swipe(eType) {
console.log(eType)
if(eType === 'swipeleft' && this.selectedIndex < this.totalTabs){
this.selectedIndex …Run Code Online (Sandbox Code Playgroud) hammer.js angular-material angular-material2 angular angular5
我正在使用materialize css.我正在使用侧面导航,并希望即使在移动设备上也可以看到.我正在使用以下代码,但它不起作用.
@media only screen and (max-width: 992px) {
.side-nav{
visibility: visible;
opacity: 100;
}
}
Run Code Online (Sandbox Code Playgroud)
它一直隐藏在小屏幕上.