NewDadaFE/react-impression

selectOption组件取label时没有对数字做字符串转换

Closed this issue · 0 comments

selectOption组件中,如果labelName为空,且value是一个数字,labelName的值会直接取到数字类型的value,并没有转换成字符串

key: "getLabel",
    value: function getLabel() {
      return this.labelName || (typeof this.props.value === 'string' || typeof this.props.value === 'number' ? this.props.value : '');
    }

之后在queryChange中调用数字的toLowerCase就会报错,因为数字没有这个方法

var defaultMethod = function defaultMethod(input, option) {
      return option.toLowerCase().indexOf(input.toLowerCase()) > -1;
};

var visible = defaultMethod(query, this.getLabel());
this.setState({
        visible: visible
 });

20190527055808