1
- import { LiteralUnion } from '../_util/type' ;
1
+ import { LiteralUnion , tuple } from '../_util/type' ;
2
2
import { PresetColorType } from '../_util/colors' ;
3
3
import { isPresetColor } from './utils' ;
4
4
import { defaultConfigProvider } from '../config-provider' ;
5
5
import { HTMLAttributes , FunctionalComponent , VNodeTypes , inject , CSSProperties } from 'vue' ;
6
+ import PropTypes from '../_util/vue-types' ;
6
7
7
8
type RibbonPlacement = 'start' | 'end' ;
8
9
@@ -14,7 +15,7 @@ export interface RibbonProps extends HTMLAttributes {
14
15
}
15
16
16
17
const Ribbon : FunctionalComponent < RibbonProps > = ( props , { attrs, slots } ) => {
17
- const { prefixCls : customizePrefixCls , color, text, placement = 'end' } = props ;
18
+ const { prefixCls : customizePrefixCls , color, text = slots . text ?. ( ) , placement = 'end' } = props ;
18
19
const { class : className , style } = attrs ;
19
20
const children = slots . default ?.( ) ;
20
21
const { getPrefixCls, direction } = inject ( 'configProvider' , defaultConfigProvider ) ;
@@ -48,5 +49,12 @@ const Ribbon: FunctionalComponent<RibbonProps> = (props, { attrs, slots }) => {
48
49
} ;
49
50
50
51
Ribbon . displayName = 'ABadgeRibbon' ;
52
+ Ribbon . inheritAttrs = false ;
53
+ Ribbon . props = {
54
+ prefix : PropTypes . string ,
55
+ color : PropTypes . string ,
56
+ text : PropTypes . any ,
57
+ placement : PropTypes . oneOf ( tuple ( 'start' , 'end' ) ) ,
58
+ } ;
51
59
52
60
export default Ribbon ;
0 commit comments