材质ui reactjs未捕获的TypeError:无法设置未定义的属性'disposed_'

时间:2019-09-11 06:46:06

标签: reactjs material-ui

我正在使用Material UI的select组件显示项目列表,但我不知道为什么会引发此错误,并且我检查了所有内容 我也是Reactjs和Material UI的新手 请帮助我找到处理此异常的正确方法

错误: 拖动时发生错误。任何现有的拖动都将被取消。>未捕获的TypeError:无法设置未定义的属性'disposed _'

这是组件的代码

const SymbologyFieldType = [
{ value: "prioritizationIndex", label: <Translate id="prioritizationIndex"></Translate> },
{ value: "riskIndexStructural", label: <Translate id="RiskIndexStructural"></Translate> },
{ value: "riskIndexNonStructural", label: <Translate id="riskIndexNonStructural"></Translate> },
{ value: "riskIndexOrganizational", label: <Translate id="riskIndexOrganizational"></Translate> },
]


class ProvinceRiskInfoMap extends Component {

constructor(props) {
    super(props)

    this.props.addTranslation(globalTranslations);

    this.state = {
        width: 0, height: 0,
        SymbologyField: "prioritizationIndex"
    }

    this.handleChangeSybologyField = this.handleChangeSybologyField.bind(this);

}


handleChangeSybologyField = name => event => {
    console.log("handleChangeSybologyField")
    // this.setState({
    //     SymbologyField: event.target.value
    // })
}
render() {

    const { classes, theme, activeLanguage, healthcareLocationType, provinceRiskInfo4HospitalGeojson, provinceRiskInfo4HealthHouseGeojson } = this.props;

    const { width, SymbologyField } = this.state;

    let provinceRiskInfo = provinceRiskInfo4HospitalGeojson
    if (healthcareLocationType === "HealthHome") {
        provinceRiskInfo = provinceRiskInfo4HealthHouseGeojson
    }
    return (
        <div>
            <FormControl className={classes.formControl}>
                <InputLabel htmlFor="age-simple">Age</InputLabel>
                <Select
                    value={SymbologyField}
                    onChange={this.handleChangeSybologyField("")}
                    inputProps={{
                        name: 'label',
                        id: 'value',
                    }}
                    required
                >
                    {
                        SymbologyFieldType.map(item => (
                            <MenuItem key={item.value} value={item.value}>
                                {item.label}
                            </MenuItem>
                        ))
                    }

                </Select>
            </FormControl>
        </div>
    )
}
}

0 个答案:

没有答案