How to solve Uncaught (in promise) error in VUE?

When writing the vue project interface today, there was an Uncaught (in promise) error error.

 

 

 

I took a closer look, the interface is ok,

 

 

 

Me where the problem seems to have nothing, why the console which will be reported this wrong?

 

Later I found out that I did not write catch and he forcibly threw the error, so I changed the code to the following.

 

 

 

 

But after the change, it did not report the Uncaught (in promise) error error, and the other errors were reported, and a bunch of such errors were reported ↓

 

 

 

 

 

Reported so many mistakes, almost forced me. (But don’t panic, raise Erlang’s legs, drink a glass of water, and continue to look down)

 

 

      .catch(err=>{
this.$message.error(err.message);
console.log(err);
})

 

Just write message after err.


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *