Skip to main content

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:

  • 键盘生命周期事件 无需任何原生插件
  • 硬件返回按钮监听器 用于自定义 Android 设备上的硬件返回按钮行为
  • Capacitor 或 Cordova 中的状态栏支持,允许用户通过点击状态栏滚动到视图顶部
  • 滚动辅助实用程序可滚动内容,以便屏幕键盘不会覆盖焦点文本输入
  • 在 Material Design 模式下激活按钮时的 涟漪效果
  • 其他点击和聚焦实用程序,使 Ionic 应用的使用体验更加原生

程序化焦点

🌐 Programmatic Focus

Ionic 为带有 ion-focusable 类的组件提供了焦点实用工具。这些实用工具在按下某些键盘键(如 Tab)时,会自动管理组件的焦点。组件也可以通过使用 ion-appsetFocus 方法,根据用户操作以编程方式获取焦点。

属性

🌐 Properties

No properties available for this component.

事件

🌐 Events

No events available for this component.

方法

🌐 Methods

setFocus

DescriptionUsed 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.)
SignaturesetFocus(elements: HTMLElement[]) => Promise<void>
Parameterselements: An array of HTML elements to set focus on.

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.