fix: form.create lose slots #1998
parent
33175eca19
commit
3d3884bef3
|
@ -1,6 +1,5 @@
|
||||||
import { filterEmpty, parseStyleText } from './props-util';
|
import { filterEmpty, parseStyleText } from './props-util';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { warning } from '../vc-util/warning';
|
|
||||||
|
|
||||||
export function cloneVNode(vnode, deep) {
|
export function cloneVNode(vnode, deep) {
|
||||||
const componentOptions = vnode.componentOptions;
|
const componentOptions = vnode.componentOptions;
|
||||||
|
|
|
@ -710,7 +710,7 @@ function createBaseForm(option = {}, mixins = []) {
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { $slots } = this;
|
const { $slots, $scopedSlots } = this;
|
||||||
const formProps = {
|
const formProps = {
|
||||||
[formPropName]: this.getForm(),
|
[formPropName]: this.getForm(),
|
||||||
};
|
};
|
||||||
|
@ -729,9 +729,18 @@ function createBaseForm(option = {}, mixins = []) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
if (Object.keys($scopedSlots).length) {
|
||||||
|
wrappedComponentProps.scopedSlots = $scopedSlots;
|
||||||
|
}
|
||||||
|
const slotsKey = Object.keys($slots);
|
||||||
return WrappedComponent ? (
|
return WrappedComponent ? (
|
||||||
<WrappedComponent {...wrappedComponentProps}>{$slots.default}</WrappedComponent>
|
<WrappedComponent {...wrappedComponentProps}>
|
||||||
|
{slotsKey.length
|
||||||
|
? slotsKey.map(name => {
|
||||||
|
return <template slot={name}>{$slots[name]}</template>;
|
||||||
|
})
|
||||||
|
: null}
|
||||||
|
</WrappedComponent>
|
||||||
) : null;
|
) : null;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue