本文介绍了如何在离子框架采用CSS选择器来隔离特定平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到一个罕见的情况来了(虽然这是可以理解的,甚至是Android和iOS之间不同的行为),我想在科尔多瓦的应用程序,我在爱奥尼亚框架开发专门使用一个不同的风格适用于iOS。

I came across a rare situation (though it's understandable given different behaviours between even Android and iOS) where I wanted to use a different style specifically for iOS in a Cordova app I am developing on the Ionic-framework.

我不知道隔离基于平台我选择的最好方法?基本上,我不知道我怎么会插入一个类到我的应用程序识别平台,每个页面的body标签。

I wondered the best way to isolate my selectors based on platform? Basically I wondered how I could insert a class into the body tag of every page in my app identifying the platform.

我最初的选择是我可以使用CordovaDeviceModule并通过自定义指令或纳克级返回平台。但是,这是有点重手,并提供离子更清洁的方式来识别平台?

My initial options were I could use the CordovaDeviceModule and return the platform via a custom directive or ng-class. But is this a bit heavy handed, does ionic provide a cleaner way to identify the platform?

我运行离子,V1.0.0,beta.13

I am running Ionic, v1.0.0-beta.13

推荐答案

因此​​,原来的离子平台已经出炉类进入体内类已经,好和容易。

So it turns out ionic have platform classes baked into the body class already, nice and easy.

我所要做的就是在

.platform-ios {

}

下面是与文章

http://forum.ionicframework.com/t/how-to-use-platform-ios-and-platform-cordova-css-classes/5898

我还没有能够找到记录可用车身平台选择一个明确的清单,但这里是我迄今发现的。

I still haven't been able to find a clear list of the available body platform selectors documented, but here is what I have found so far.

.platform-ios
.platform-cordova
.platform-ipad
.platform-browser
.platform-linux
.platform-android
.platform-android4_2
.platform-c 
.platform-macintel
.platform-ios8
.platform-ios8_1
.platform-webview

我觉得平台-C指的是设备级为这里讨论:http://ionicframework.com/docs/api/utility/ionic.Platform/

这篇关于如何在离子框架采用CSS选择器来隔离特定平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:53