File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export const ColProps = {
2727 xl : objectOrNumber ,
2828 xxl : objectOrNumber ,
2929 prefixCls : PropTypes . string ,
30+ flex : stringOrNumber ,
3031} ;
3132
3233export default {
@@ -38,13 +39,25 @@ export default {
3839 default : ( ) => null ,
3940 } ,
4041 } ,
42+ methods : {
43+ parseFlex ( flex ) {
44+ if ( typeof flex === 'number' ) {
45+ return `${ flex } ${ flex } auto` ;
46+ }
47+ if ( / ^ \d + ( \. \d + ) ? ( p x | e m | r e m | % ) $ / . test ( flex ) ) {
48+ return `0 0 ${ flex } ` ;
49+ }
50+ return flex ;
51+ } ,
52+ } ,
4153 render ( ) {
4254 const {
4355 span,
4456 order,
4557 offset,
4658 push,
4759 pull,
60+ flex,
4861 prefixCls : customizePrefixCls ,
4962 $slots,
5063 rowContext,
@@ -105,6 +118,11 @@ export default {
105118 } ;
106119 }
107120 }
121+
122+ if ( flex ) {
123+ divProps . style . flex = this . parseFlex ( flex ) ;
124+ }
125+
108126 return < div { ...divProps } > { $slots . default } </ div > ;
109127 } ,
110128} ;
Original file line number Diff line number Diff line change @@ -19,6 +19,13 @@ export declare class Col extends AntdComponent {
1919 */
2020 order : ColSpanType ;
2121
22+ /**
23+ * the layout fill of flex
24+ * @default none
25+ * @type ColSpanType
26+ */
27+ flex : ColSpanType ;
28+
2229 /**
2330 * the number of cells to offset Col from the left
2431 * @default 0
You can’t perform that action at this time.
0 commit comments