current position:Home>[Vue] front end error: cannot read properties of undefined (reading 'split')

[Vue] front end error: cannot read properties of undefined (reading 'split')

2022-05-15 02:10:18Triumph-light

The emergence of problems :

Because when doing the project , Want to convert numbers into Chinese characters :
 Insert picture description here
But there will be a report on the console Cannot read properties of undefined (reading ‘split‘)
When debugging, it is found that the data will appear slowly

The cause of the problem :

Because it's a request to get this studentinfo This data , So before we get the data , It will be for undefined, There is no way to use it at this time .
In short, it is the problem of data asynchrony .

solution :

When the data is undefined When , Remove this , When it's not for undefined When it's time to execute , So add a if Sentence to judge

copyright notice
author[Triumph-light],Please bring the original link to reprint, thank you.

Random recommended