ion-app
App 是 Ionic 应用的容器元素。每个项目只能有一个 <ion-app>
元素。一个应用可以有许多 Ionic 组件,包括菜单、页眉、内容和页脚。覆盖组件在渲染时会附加到 <ion-app>
。
¥App is a container element for an Ionic application. There should only be one <ion-app>
element per project. An app can have many Ionic components including menus, headers, content, and footers. The overlay components get appended to the <ion-app>
when they are presented.
使用 ion-app
可以实现以下行为:
¥Using ion-app
enables the following behaviors:
-
键盘生命周期事件 无需任何原生插件
¥Keyboard Lifecycle Events without the need for any native plugins
-
硬件后退按钮监听器 用于自定义 Android 设备上的硬件后退按钮行为
¥Hardware Back Button Listeners for customizing the hardware back button behavior on Android devices
-
Capacitor 或 Cordova 中的状态栏支持,允许用户通过点击状态栏滚动到视图顶部
¥Status bar support in Capacitor or Cordova which allows users to scroll to the top of the view by tapping the status bar
-
滚动辅助实用程序可滚动内容,以便屏幕键盘不会覆盖焦点文本输入
¥Scroll assist utilities which scroll the content so focused text inputs are not covered by the on-screen keyboard
-
在 Material Design 模式下激活按钮时的 连锁反应
¥Ripple effect when activating buttons on Material Design mode
-
其他点击和聚焦实用程序,使 Ionic 应用的使用体验更加原生
¥Other tap and focus utilities which make the experience of using an Ionic app feel more native
程序化焦点
¥Programmatic Focus
Ionic 为具有 ion-focusable
类的组件提供焦点实用程序。当按下某些键盘键(如 Tab)时,这些实用程序会自动管理组件的焦点。还可以使用 ion-app
中的 setFocus
方法以编程方式聚焦组件以响应用户操作。
¥Ionic offers focus utilities for components with the ion-focusable
class. These utilities automatically manage focus for components when certain keyboard keys, like Tab, are pressed. Components can also be programmatically focused in response to user actions using the setFocus
method from ion-app
.
属性
¥Properties
No properties available for this component.
事件
¥Events
No events available for this component.
方法
¥Methods
setFocus
Description | Used to set focus on an element that uses ion-focusable . Do not use this if focusing the element as a result of a keyboard event as the focus utility should handle this for us. This method should be used when we want to programmatically focus an element as a result of another user action. (Ex: We focus the first element inside of a popover when the user presents it, but the popover is not always presented as a result of keyboard action.) |
Signature | setFocus(elements: HTMLElement[]) => Promise<void> |
CSS 阴影部分
¥CSS Shadow Parts
No CSS shadow parts available for this component.
CSS 自定义属性
¥CSS Custom Properties
No CSS custom properties available for this component.
插槽
¥Slots
No slots available for this component.