fix: scope props merge defaultProps (#2716)

This commit is contained in:
唐澜 2023-12-01 15:27:30 +08:00 committed by GitHub
parent 8f5ba69813
commit ebdcc41461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,7 +429,14 @@ export default function baseRendererFactory(): IBaseRenderComponent {
__createDom = () => { __createDom = () => {
const { __schema, __ctx, __components = {} } = this.props; const { __schema, __ctx, __components = {} } = this.props;
const scope: any = {}; // merge defaultProps
const scopeProps = {
...__schema.defaultProps,
...this.props,
};
const scope: any = {
props: scopeProps,
};
scope.__proto__ = __ctx || this; scope.__proto__ = __ctx || this;
const _children = getSchemaChildren(__schema); const _children = getSchemaChildren(__schema);