mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
set view transition by config
This commit is contained in:
@ -152,7 +152,7 @@ export function ionicBootstrap(ComponentType, config) {
|
|||||||
config.setPlatform(Platform);
|
config.setPlatform(Platform);
|
||||||
|
|
||||||
// make the config global
|
// make the config global
|
||||||
GlobalIonicConfig = config;
|
IonicConfig.setGlobal(config);
|
||||||
|
|
||||||
// config and platform settings have been figured out
|
// config and platform settings have been figured out
|
||||||
// apply the correct CSS to the app
|
// apply the correct CSS to the app
|
||||||
@ -196,5 +196,3 @@ export function load(app) {
|
|||||||
app.main(ionicBootstrap);
|
app.main(ionicBootstrap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export let GlobalIonicConfig = null;
|
|
||||||
|
@ -3,7 +3,7 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotatio
|
|||||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||||
|
|
||||||
import * as util from 'ionic/util';
|
import * as util from 'ionic/util';
|
||||||
import {GlobalIonicConfig} from '../components/app/app';
|
import {IonicConfig} from './config';
|
||||||
import {
|
import {
|
||||||
Aside, Content, Refresher,
|
Aside, Content, Refresher,
|
||||||
Slides, Slide, SlidePager,
|
Slides, Slide, SlidePager,
|
||||||
@ -100,9 +100,9 @@ function appendModeConfig(ComponentType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get the property values from a global user/platform config
|
// get the property values from a global user/platform config
|
||||||
let configVal = GlobalIonicConfig.setting(prop);
|
let configVal = IonicConfig.global.setting(prop);
|
||||||
if (configVal) {
|
if (configVal) {
|
||||||
instance[prop] = globalPropertyValue;
|
instance[prop] = configVal;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ function appendModeConfig(ComponentType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!platformMode) {
|
if (!platformMode) {
|
||||||
platformMode = GlobalIonicConfig.setting('mode');
|
platformMode = IonicConfig.global.setting('mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = config.classId || (config.selector && config.selector.replace('ion-', ''));
|
let id = config.classId || (config.selector && config.selector.replace('ion-', ''));
|
||||||
|
@ -12,7 +12,7 @@ export class IonicConfig {
|
|||||||
|
|
||||||
// override defaults w/ user config
|
// override defaults w/ user config
|
||||||
if (settings) {
|
if (settings) {
|
||||||
extend(this._settings, setting);
|
extend(this._settings, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,4 +125,14 @@ export class IonicConfig {
|
|||||||
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
|
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static setGlobal(config) {
|
||||||
|
globalConfig = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get global() {
|
||||||
|
return globalConfig;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export let globalConfig = null;
|
||||||
|
@ -70,6 +70,7 @@ Platform.register({
|
|||||||
],
|
],
|
||||||
settings: {
|
settings: {
|
||||||
mode: 'ios',
|
mode: 'ios',
|
||||||
|
viewTransition: 'ios',
|
||||||
tapPolyfill: true
|
tapPolyfill: true
|
||||||
},
|
},
|
||||||
isMatch(p) {
|
isMatch(p) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import {Animation} from '../animations/animation';
|
import {Animation} from '../animations/animation';
|
||||||
|
import {IonicConfig} from '../config/config';
|
||||||
|
|
||||||
const SHOW_NAVBAR_CSS = 'show-navbar';
|
const SHOW_NAVBAR_CSS = 'show-navbar';
|
||||||
const SHOW_VIEW_CSS = 'show-view';
|
const SHOW_VIEW_CSS = 'show-view';
|
||||||
@ -84,7 +85,7 @@ export class Transition extends Animation {
|
|||||||
STATIC CLASSES
|
STATIC CLASSES
|
||||||
*/
|
*/
|
||||||
static create(nav, opts = {}) {
|
static create(nav, opts = {}) {
|
||||||
const name = opts.animation || 'ios';
|
const name = opts.animation || IonicConfig.global.setting('viewTransition');
|
||||||
|
|
||||||
let TransitionClass = TransitionRegistry[name];
|
let TransitionClass = TransitionRegistry[name];
|
||||||
if (!TransitionClass) {
|
if (!TransitionClass) {
|
||||||
|
Reference in New Issue
Block a user