Skip to content

Commit

Permalink
feat: card 组件 extra 属性支持 ReactNode
Browse files Browse the repository at this point in the history
  • Loading branch information
robinv8 committed Nov 6, 2023
1 parent e67eee3 commit acb1924
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions packages/taro-ui/src/components/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export default class AtCard extends React.Component<AtCardProps> {

<Text className='at-card__header-title'>{title}</Text>
{extra && (
<Text style={{ ...extraStyle }} className='at-card__header-extra'>
<View style={{ ...extraStyle }} className='at-card__header-extra'>
{extra}
</Text>
</View>
)}
</View>
<View className='at-card__content'>
Expand All @@ -74,7 +74,6 @@ AtCard.defaultProps = {
isFull: false,
thumb: '',
title: '',
extra: '',
extraStyle: {}
}

Expand All @@ -83,7 +82,7 @@ AtCard.propTypes = {
isFull: PropTypes.bool,
thumb: PropTypes.string,
title: PropTypes.string,
extra: PropTypes.string,
extra: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
icon: PropTypes.object,
onClick: PropTypes.func,
renderIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
Expand Down
4 changes: 2 additions & 2 deletions packages/taro-ui/types/card.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MouseEvent, ComponentClass } from 'react'
import { ComponentClass } from 'react'
import { CommonEventFunction } from '@tarojs/components/types/common'

import AtComponent, { AtIconBaseProps } from './base'
Expand All @@ -23,7 +23,7 @@ export interface AtCardProps extends AtComponent {
/**
* 元素的额外信息
*/
extra?: string
extra?: JSX.Element | string
/**
* 元素的额外信息自定义样式
*/
Expand Down

0 comments on commit acb1924

Please sign in to comment.