commit | author | age
|
a5a648
|
1 |
import { Injectable } from '@angular/core'; |
W |
2 |
import { LoadingController, Loading } from 'ionic-angular'; |
|
3 |
|
|
4 |
@Injectable() |
|
5 |
export class LoadingService { |
|
6 |
private loader: Loading; |
|
7 |
private isShow = false; |
|
8 |
|
|
9 |
constructor(public loadingCtrl: LoadingController) { |
|
10 |
} |
|
11 |
|
|
12 |
show() { |
|
13 |
if (this.isShow) return; |
|
14 |
this.loader = this.loadingCtrl.create({ |
|
15 |
content: '请稍等...' |
|
16 |
}); |
|
17 |
this.isShow = true; |
|
18 |
this.loader.present(); |
|
19 |
} |
|
20 |
|
|
21 |
hide() { |
|
22 |
if (!this.isShow) return; |
|
23 |
this.isShow = false; |
|
24 |
this.loader.dismiss(); |
|
25 |
} |
|
26 |
} |