mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
@@ -1,5 +1,5 @@
|
||||
import { Component, NgModule } from '@angular/core';
|
||||
import { IonicApp, IonicModule, Platform, NavController } from '../../ionic-angular';
|
||||
import { Config, IonicApp, IonicModule, Platform, NavController } from '../../ionic-angular';
|
||||
|
||||
if (!window.localStorage) {
|
||||
Object.defineProperty(window, 'localStorage', new (function () {
|
||||
@@ -86,34 +86,11 @@ export class TabPage {
|
||||
export class ApiDemoPage {
|
||||
config: any;
|
||||
initialConfig: any;
|
||||
|
||||
constructor(public platform: Platform, public navCtrl: NavController) {
|
||||
|
||||
if (window.localStorage.getItem('configDemo') !== null) {
|
||||
this.config = JSON.parse(window.localStorage.getItem('configDemo'));
|
||||
} else if (platform.is('ios')) {
|
||||
this.config = {
|
||||
'backButtonIcon': 'ios-arrow-back',
|
||||
'iconMode': 'ios',
|
||||
'tabsPlacement': 'bottom'
|
||||
};
|
||||
} else if (platform.is('windows')) {
|
||||
this.config = {
|
||||
'backButtonIcon': 'ios-arrow-back',
|
||||
'iconMode': 'ios',
|
||||
'tabsPlacement': 'top'
|
||||
};
|
||||
} else {
|
||||
this.config = {
|
||||
'backButtonIcon': 'md-arrow-back',
|
||||
'iconMode': 'md',
|
||||
'tabsPlacement': 'bottom'
|
||||
};
|
||||
}
|
||||
|
||||
this.initialConfig = JSON.parse(JSON.stringify(this.config));
|
||||
constructor(_config: Config, public navCtrl: NavController) {
|
||||
this.config = _config.settings();
|
||||
}
|
||||
|
||||
|
||||
load() {
|
||||
window.localStorage.setItem('configDemo', JSON.stringify(this.config));
|
||||
window.location.reload();
|
||||
@@ -140,7 +117,36 @@ export class PushPage {
|
||||
template: '<ion-nav [root]="root" #content></ion-nav>'
|
||||
})
|
||||
export class ApiDemoApp {
|
||||
config: any;
|
||||
root = TabPage;
|
||||
constructor(public _config: Config, public platform: Platform) {
|
||||
|
||||
if (window.localStorage.getItem('configDemo') !== null) {
|
||||
this.config = JSON.parse(window.localStorage.getItem('configDemo'));
|
||||
} else if (platform.is('ios')) {
|
||||
this.config = {
|
||||
'backButtonIcon': 'ios-arrow-back',
|
||||
'iconMode': 'ios',
|
||||
'tabsPlacement': 'bottom'
|
||||
};
|
||||
} else if (platform.is('windows')) {
|
||||
this.config = {
|
||||
'backButtonIcon': 'ios-arrow-back',
|
||||
'iconMode': 'ios',
|
||||
'tabsPlacement': 'top'
|
||||
};
|
||||
} else {
|
||||
this.config = {
|
||||
'backButtonIcon': 'md-arrow-back',
|
||||
'iconMode': 'md',
|
||||
'tabsPlacement': 'bottom'
|
||||
};
|
||||
}
|
||||
|
||||
this._config.set('tabsPlacement', this.config.tabsPlacement);
|
||||
this._config.set('iconMode', this.config.iconMode);
|
||||
this._config.set('backButtonIcon', this.config.backButtonIcon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user