沈斌
2018-07-12 1dfc8bc300a6ae0822514ddf2e1399d4762fa1b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Component, HostListener } from '@angular/core';
import * as screenfull from 'screenfull';
 
@Component({
    selector: 'header-fullscreen',
    template: `
    <i class="anticon anticon-{{status ? 'shrink' : 'arrows-alt'}}"></i>
    {{(status ? 'fullscreen-exit' : 'fullscreen') | translate }}
    `
})
export class HeaderFullScreenComponent {
 
    status = false;
 
    @HostListener('click')
    _click() {
        if (screenfull.enabled) {
            screenfull.toggle();
        }
        this.status = !screenfull.isFullscreen;
    }
}