网页 综合 更新时间 2026-11-14 16:23:34

Config | Ionic Framework

自动蜘蛛 ionicframework.com 正文约 2357 字
Ionic Config provides a way to change the properties of components globally across an app. It can set the app mode, tab button layout, animations, and more.
The available config keys can be found in the IonicConfig interface.
The following example disables ripple effects and default the mode to Material Design:
The setupIonicReact function must be called before rendering any Ionic components (including IonApp).
Ionic Config is not reactive. Updating the config's value after the component has rendered will result in the previous value. It is recommended to use a component's properties instead of updating the config, when you require reactive values.
Ionic Config can also be set on a per-platform basis. For example, this allows you to disable animations if the app is being run in a browser on a potentially slower device. Developers can take advantage of the Platform utilities to accomplish this.
In the following example, we are disabling all animations in our Ionic app only if the app is running in a mobile web browser.
Since the config is set at runtime, you will not have access to the Platform Dependency Injection. Instead, you can use the underlying functions that the provider uses directly.
Refer to the Angular Platform Documentation for the types of platforms you can detect.
Since the config is set at runtime, you will not have access to the Platform Dependency Injection. Instead, you can use the underlying functions that the provider uses directly.
Refer to the Angular Platform Documentation for the types of platforms you can detect.
Refer to the React Platform Documentation for the types of platforms you can detect.
Refer to the Vue Platform Documentation for the types of platforms you can detect.
The next example allows you to set an entirely different configuration based upon the platform, falling back to a default config if no platforms match:
This final example allows you to accumulate a config object based upon different platform requirements.
In some cases, you may need to access the current Ionic mode programmatically within your application logic. This can be useful for applying conditional behavior, fetching specific assets, or performing other actions based on the active styling mode.
Ionic Angular provides a Config provider for accessing the Ionic Config.
Below are the config options that Ionic uses.
访问原文 返回搜索 https://ionicframework.com/docs/developing/config
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。