When writing a project, it’s ok to test yourself. I found it in the joint ops. This error will be reported when a page clicks on each drop-down selection.

Search for each drop-down box you write and find: key given. I had no problem mocking myself.

Segmentfault.com/q/101000000… Blog.csdn.net/wangwangwan…

Then it retrieves the data from the interface in the form of 22,12,23. It can only be used by escaping the array into numeric form. The data I got was in the form of 33. The escaped array is [NULL,33]. An error was reported because key was given a null value. That means the filtration wasn’t rigorous enough. Then refine the escape function.

strToArrayForId(_str){
    return _str.split(', ').map(item=>parseInt(item)).filter(item=>! isNaN(item)); },Copy the code

Problem solved perfectly.

If one element element is missing a key, all the keys on the page will fail. Another pit. Filter null values when used! =null ! =NaN is not resolved. Forgetting one property, whether NaN is empty or not even equal to itself. This can only be determined by isNaN. Sin, sin!