如何根据离子应用程序构建类型在 css 中应用 if else?

How to apply if else in css based on ionic app build type?

我正在创建简单的 ionic 4 应用程序,我将一些 css 用于 android 以及 ios。现在,当我构建 ios、android css 时发生冲突。我想 if/else 根据构建类型在 css 中设置条件?

platform-specificcsscsscss类之间的切换不用写if-else

ionic 4 中有 platform-specific css 的方法。

对于 android 平台,这样写你的 css :
md 因为 android 以及其他平台默认使用 material 设计。

.md .sample {}

并且在使用 IOS 平台时:

.ios .sample {}

这里 docs 了解更多信息。