Skip to content

Commit d6332bf

Browse files
author
张宁宁
committed
feat: title 属性类型支持传入 ReactNode
1 parent d162f17 commit d6332bf

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/taro-ui-docs/markdown/tabbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default class Index extends Taro.Component {
186186

187187
| 参数 | 说明 | 类型 | 可选值 | 默认值 | 可选或必填
188188
| ---------- | -------------------------------------- | ------- | ------------------------------------------------------------------- | -------- |-------- |
189-
| title | 标题 | String | - | 0 | 必填 |
189+
| title | 标题 | ReactNode | - | - | 必填 |
190190
| iconPrefixClass | icon className 前缀,用于第三方字体图标库,比如想使用'fa fa-clock' 的图标,则 传入`iconPrefixClass='fa' iconType='clock'`,[拓展图标库详细](/#/docs/icon) | String | - | - | - |
191191
| iconType | 未选中时展示的 icon 类型,可扩展第三方字体图标库,[拓展图标库详细](/#/docs/icon) | String | - | - | 可选 |
192192
| selectedIconType | 选中时展示的 icon 类型,可扩展第三方字体图标库,[拓展图标库详细](/#/docs/icon) | String | - | - |可选 |

packages/taro-ui/src/components/tab-bar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export default class AtTabBar extends React.Component<AtTabBarProps> {
8282
'at-tab-bar__item--active': current === i
8383
})}
8484
style={current === i ? selectedStyle : defaultStyle}
85-
key={item.title}
85+
key={i}
8686
onClick={this.handleClick.bind(this, i)}
8787
>
8888
{item.iconType ? (

packages/taro-ui/types/tab-bar.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MouseEvent, ComponentClass } from 'react'
1+
import { ReactNode, ComponentClass } from 'react'
22
import { CommonEvent } from '@tarojs/components/types/common'
33

44
import AtComponent from './base'
@@ -20,7 +20,7 @@ export interface TabItem {
2020
/**
2121
* 标题
2222
*/
23-
title: string
23+
title: ReactNode
2424
/**
2525
* icon className 前缀,用于第三方字体图标库,
2626
* 比如想使用'fa fa-clock' 的图标,则传入 iconPrefixClass='fa' iconType='clock',

0 commit comments

Comments
 (0)