跳到主要内容
版本:v7

ion-tab-button

shadow

标签按钮(Tab button)是放置在标签栏(tab bar)内的 UI 组件。标签按钮可以指定图标和标签的布局,并连接到标签视图(tab view)

请参阅tabs 文档了解更多关于配置标签的详细信息。

用法

<ion-tabs>
<!-- 标签栏 -->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="schedule">
<ion-icon name="calendar" aria-hidden="true"></ion-icon>
<ion-label>日程</ion-label>
</ion-tab-button>

<ion-tab-button tab="speakers">
<ion-icon name="person-circle" aria-hidden="true"></ion-icon>
<ion-label>演讲者</ion-label>
</ion-tab-button>

<ion-tab-button tab="map">
<ion-icon name="map" aria-hidden="true"></ion-icon>
<ion-label>地图</ion-label>
</ion-tab-button>

<ion-tab-button tab="about">
<ion-icon name="information-circle" aria-hidden="true"></ion-icon>
<ion-label>关于</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>

属性

disabled

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

download

说明This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want).
属性download
类型string | undefined
默认值undefined

href

说明Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
属性href
类型string | undefined
默认值undefined

layout

说明Set the layout of the text and icon in the tab bar. It defaults to "icon-top".
属性layout
类型"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined
默认值undefined

mode

说明The mode determines which platform styles to use.

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

rel

说明Specifies the relationship of the target object to the link object. The value is a space-separated list of link types.
属性rel
类型string | undefined
默认值undefined

selected

说明The selected tab component
属性selected
类型boolean
默认值false

tab

说明A tab id must be provided for each ion-tab. It's used internally to reference the selected tab or by the router to switch between them.
属性tab
类型string | undefined
默认值undefined

target

说明Specifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top".
属性target
类型string | undefined
默认值undefined

事件

该组件没有可用的事件。

方法

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

CSS 阴影部分

Name说明
nativeThe native HTML anchor element that wraps all child elements.

CSS 自定义属性

Name说明
--backgroundBackground of the tab button
--background-focusedBackground of the tab button when focused with the tab key
--background-focused-opacityOpacity of the tab button background when focused with the tab key
--colorColor of the tab button
--color-focusedColor of the tab button when focused with the tab key
--color-selectedColor of the selected tab button
--padding-bottomBottom padding of the tab button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the tab button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the tab button
--padding-topTop padding of the tab button
--ripple-colorColor of the button ripple effect

插槽

该组件没有可用的插槽。