VUE How to use Async, AWAIT implementation synchronous request

This article mainly introduces how Vue uses Async, AWAIT implementation synchronous request, and the document introduction is very detailed in the document, there must be a certain reference value for everyone’s learning or work, and friends needed can be referred to

The following is Vue Method Demo:

  ({type: 'post', URL: ', URL:' /Linewell/system/user/'/*,}); console.log ("res);}  

wherein the method needs to be modified with async , Then

VAR variable = AWAIT request

can assign the requested response to Reses, otherwise, according to the traditional asynchronous request, the variable RESES is defined, and the Rense is assigned to the Success function. Printing Rense is still empty.

But we generally do not recommend this to write. If you really need to get the corresponding information, you can package the business code into a method, and then call this method in the Success callback function, transfer the required parameters. .

The above is all the content of this article, I hope to help everyone, I hope everyone will support Tumi Cloud.

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment