parent
39541875ff
commit
745b2983ba
|
@ -27,6 +27,7 @@ export const ColProps = {
|
|||
xl: objectOrNumber,
|
||||
xxl: objectOrNumber,
|
||||
prefixCls: PropTypes.string,
|
||||
flex: stringOrNumber,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@ -38,6 +39,17 @@ export default {
|
|||
default: () => null,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
parseFlex(flex) {
|
||||
if (typeof flex === 'number') {
|
||||
return `${flex} ${flex} auto`;
|
||||
}
|
||||
if (/^\d+(\.\d+)?(px|em|rem|%)$/.test(flex)) {
|
||||
return `0 0 ${flex}`;
|
||||
}
|
||||
return flex;
|
||||
},
|
||||
},
|
||||
render() {
|
||||
const {
|
||||
span,
|
||||
|
@ -45,6 +57,7 @@ export default {
|
|||
offset,
|
||||
push,
|
||||
pull,
|
||||
flex,
|
||||
prefixCls: customizePrefixCls,
|
||||
$slots,
|
||||
rowContext,
|
||||
|
@ -105,6 +118,11 @@ export default {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (flex) {
|
||||
divProps.style.flex = this.parseFlex(flex);
|
||||
}
|
||||
|
||||
return <div {...divProps}>{$slots.default}</div>;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -19,6 +19,13 @@ export declare class Col extends AntdComponent {
|
|||
*/
|
||||
order: ColSpanType;
|
||||
|
||||
/**
|
||||
* the layout fill of flex
|
||||
* @default none
|
||||
* @type ColSpanType
|
||||
*/
|
||||
flex: ColSpanType;
|
||||
|
||||
/**
|
||||
* the number of cells to offset Col from the left
|
||||
* @default 0
|
||||
|
|
Loading…
Reference in New Issue