The split() string in the Vue project is converted into an array and an error is reported. Solution typeerror: cannot read property ‘split’ of null

In the Vue project, a common method split () is encountered. Because it is common and easy to remember, split (”) is recorded here,

The string is cut into an array with spaces as boundaries. Parameters can be written in quotation marks,

For example, split (‘,  ‘) , This is to   , Cut bounds into arrays


  However, when converting a string into an array, an error will be reported if the string is empty


  In case of the above errors, you can judge first


Similar Posts: