跳到主要内容
版本:v6

ion-back-button

shadow

返回按钮在点击时导航到应用历史记录中的上一页。只有在导航堆栈中存在历史记录时才会显示,除非设置了 defaultHref。返回按钮根据模式显示不同的文本和图标,但可以进行自定义。

基本用法

自定义返回按钮

默认情况下,返回按钮在 ios 上显示文本"Back"和 "chevron-back" 图标,在 md 上显示 "arrow-back-sharp" 图标。可以通过在每个返回按钮组件上设置 icontext 属性来自定义。或者,可以使用全局配置中的 backButtonIconbackButtonText 属性进行全局设置。更多信息请参阅配置文档

默认返回历史

有时应用可能需要在没有历史记录时显示返回按钮并导航返回。这可以通过在返回按钮上设置 defaultHref 指向一个路径来实现。要使用 defaultHref,应用必须包含具有路径设置的路由器。

属性

color

说明The color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.
属性color
类型"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined
默认值undefined

defaultHref

说明The url to navigate back to by default when there is no history.
属性default-href
类型string | undefined
默认值undefined

disabled

说明If true, the user cannot interact with the button.
属性disabled
类型boolean
默认值false

icon

说明The built-in named SVG icon name or the exact src of an SVG file to use for the back button.
属性icon
类型null | string | undefined
默认值undefined

mode

说明The mode determines which platform styles to use.

这是一个虚拟属性,在初始化时设置一次,之后更改其值不会更新组件。
属性mode
类型"ios" | "md"
默认值undefined

routerAnimation

说明When using a router, it specifies the transition animation when navigating to another page.
属性undefined
类型((baseEl: any, opts?: any) => Animation) | undefined
默认值undefined

text

说明The text to display in the back button.
属性text
类型null | string | undefined
默认值undefined

type

说明The type of the button.
属性type
类型"button" | "reset" | "submit"
默认值'button'

事件

该组件没有可用的事件。

方法

该组件没有可用的公共方法。

CSS 阴影部分

Name说明
iconThe back button icon (uses ion-icon).
nativeThe native HTML button element that wraps all child elements.
textThe back button text.

CSS 自定义属性

Name说明
--backgroundBackground of the button
--background-focusedBackground of the button when focused with the tab key
--background-focused-opacityOpacity of the button background when focused with the tab key
--background-hoverBackground of the button on hover
--background-hover-opacityOpacity of the background on hover
--border-radiusBorder radius of the button
--colorText color of the button
--color-focusedText color of the button when focused with the tab key
--color-hoverText color of the button on hover
--icon-font-sizeFont size of the button icon
--icon-font-weightFont weight of the button icon
--icon-margin-bottomBottom margin of the button icon
--icon-margin-endRight margin if direction is left-to-right, and left margin if direction is right-to-left of the button icon
--icon-margin-startLeft margin if direction is left-to-right, and right margin if direction is right-to-left of the button icon
--icon-margin-topTop margin of the button icon
--icon-padding-bottomBottom padding of the button icon
--icon-padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the button icon
--icon-padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the button icon
--icon-padding-topTop padding of the button icon
--margin-bottomBottom margin of the button
--margin-endRight margin if direction is left-to-right, and left margin if direction is right-to-left of the button
--margin-startLeft margin if direction is left-to-right, and right margin if direction is right-to-left of the button
--margin-topTop margin of the button
--min-heightMinimum height of the button
--min-widthMinimum width of the button
--opacityOpacity of the button
--padding-bottomBottom padding of the button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the button
--padding-topTop padding of the button
--ripple-colorColor of the button ripple effect
--transitionTransition of the button

插槽

该组件没有可用的插槽。