mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Platform add body classes
This commit is contained in:
@ -29,6 +29,8 @@ class PlatformController {
|
||||
|
||||
set(platform) {
|
||||
activePlatform = platform;
|
||||
|
||||
this._applyBodyClasses();
|
||||
}
|
||||
|
||||
setDefault(platform) {
|
||||
@ -49,6 +51,16 @@ class PlatformController {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
_applyBodyClasses() {
|
||||
if(!activePlatform) {
|
||||
return;
|
||||
}
|
||||
|
||||
util.dom.raf(() => {
|
||||
document.body.classList.add('platform-' + activePlatform.name);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export let Platform = new PlatformController();
|
||||
|
Reference in New Issue
Block a user