Browse Source

fix: grid props

pull/2934/head
Amour1688 4 years ago
parent
commit
8124653d07
  1. 9
      components/grid/Col.tsx
  2. 6
      components/grid/Row.tsx

9
components/grid/Col.tsx

@ -43,9 +43,10 @@ function parseFlex(flex: FlexType): string {
return flex;
}
export default defineComponent<ColProps>({
export default defineComponent({
name: 'ACol',
setup(props, { slots }) {
inheritAttrs: false,
setup(_: ColProps, { slots, attrs }) {
const configProvider = inject('configProvider', defaultConfigProvider);
const rowContext = inject<rowContextState>('rowContext', {});
@ -62,12 +63,12 @@ export default defineComponent<ColProps>({
flex,
style,
...others
} = props;
} = attrs as ColProps;
const prefixCls = configProvider.getPrefixCls('col', customizePrefixCls);
let sizeClassObj = {};
['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].forEach(size => {
let sizeProps: ColSize = {};
const propSize = (props as any)[size];
const propSize = attrs[size];
if (typeof propSize === 'number') {
sizeProps.span = propSize;
} else if (typeof propSize === 'object') {

6
components/grid/Row.tsx

@ -8,7 +8,7 @@ import {
onMounted,
onBeforeUnmount,
} from 'vue';
import classNames from 'classnames';
import classNames from '../_util/classNames';
import { tuple } from '../_util/type';
import PropTypes from '../_util/vue-types';
import { defaultConfigProvider } from '../config-provider';
@ -43,12 +43,14 @@ export interface RowProps extends HTMLAttributes {
export default defineComponent<RowProps>({
name: 'ARow',
setup(props, { slots }) {
setup(_: RowProps, { slots, attrs }) {
const rowContext = reactive<rowContextState>({
gutter: undefined,
});
provide('rowContext', rowContext);
const props = attrs as RowProps;
let token: number;
onMounted(() => {

Loading…
Cancel
Save