Article From:https://segmentfault.com/q/1010000011713196
Question:

I need to click, perform some click events on/off, and to get the status of the current switch, stick it in the official case.

Answer 0:
 const {getFieldProps} = props.form; //It will prompt props is not defined.

This line should be changed.

 const {getFieldProps} = this.props.form; //It will prompt props is not defined.

onQRBarrage The function does not exist. Take a stroll slowly. Don’t be too hasty.

Supplement, roughly changed to the following. Pseudo code, I hope to be able to read.

import { createForm } from 'rc-form';

class Stuonline extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
        };
    };


    render() {
        const {getFieldProps} = this.props.form; 
        return (
            <div>
                
                    <List>
                        <Item
                            arrow="horizontal"
                            extra={'Closed ']OnClick={this.onQRBarrage}> options< /Item>< List.ItemExtra={< Switch{... GetFieldProps ('Switch8', {)InitialValue: true,ValuePropName:'checked',}})}OnClick={(checked) => {console.log (check)ED);]]/>}> switch < /List.Item>< /List>< /div>);}}/ / without this line, Stuonline component.This.props.form does not exist.Const SwitchExample = createForm () (Stuonline);Export default connect (/ /..(SwitchExample);

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *