【react】报错Need at least a key or a value or a label (only for OptGroup) for [object Object]


antd  select  组件 option value为空了 

找到赋值option打印原始数据 

 

 原因:后台返回了一条无用的数据,针对这种 错误 一般返回数据后台会直接过滤 ;为了规避这种无用数据造成前端报错;前端增加判断,过滤数据;

 let hospSelect = []
                    for (var i = 0; i < res.Hosp.length; i++) {
                        if(res.Hosp[i].id&&res.Hosp[i].descripts) hospSelect.push(<Option key={res.Hosp[i].id} alias={res.Hosp[i].descriptsSPCode}>{res.Hosp[i].descripts}</Option>)
                    }
                    this.setState({
                        hospSelect,
                    })


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 Mysql8报错:ERROR 1227 (42000): Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation 取出List>里面Map的key:value值 python报错:Exception Value:can only concatenate str (not "bytes") to str Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#‘的解决方法 [one day one question] webpack 打包报错 Cannot assign to read only property 'exports' of object '#' vue运行报错error:Cannot assign to read only property 'exports' of object '#' Map 通过key取value值时,取出的LinkedHashMap转换为实体对象 'dict_values' object does not support indexing, Python字典dict中由value查key Vue报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object 的解决方法 Vue 使用自定义组件时报错:Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM