The browser reports an error: Uncaught TypeError: Cannot read property 'trim' of undefined

This trim reported an error when I was making the project today.

First of all, we know that trim is a method applied to strings, so at this time, there may be something in the data that is not a string.

After investigation, it is found that a value is null, so adding a ternary expression can solve this problem

 

Guess you like

Origin blog.csdn.net/qq_63608386/article/details/128567912