admin管理员组

文章数量:1122846

I'm trying to add an additional setting to core/group component. Is there a way to add default value to

const withSidebarSelect = createHigherOrderComponent( ( BlockEdit ) => {
    return ( props ) => {
...

 const { attributes, setAttributes } = props;
        const { sectionType } = attributes;

        return (
            <Fragment>
                <BlockEdit { ...props } />
                <InspectorControls>
                    <PanelBody
                        title={ __( 'Section' ) }
                    >
                        <RadioControl
                            label={ __( 'Section Type' ) }
                            selected={ sectionType }
                            options={ [
                                {
                                    label: __( 'Regular' ),
                                    value: 'regular'
                                },
                                {
                                    label: __( 'Header' ),
                                    value: 'header'
                                },
                                {
                                    label: __( 'CTA' ),
                                    value: 'cta'
                                },
                            ] }
                            onChange={ ( value ) => {
                                setAttributes( {
                                    sectionType: value,
                                } );
                            } }
                        />

I want RadioControl to select "regular" by default

本文标签: block editorDefault value for highorder component in Gutenbrg