How to call the API interface (uniapp version)

1. Create a new vue page

 2. The newly created page looks like this

 3. Create a container in the js area to receive the content returned by the api

 

 4. Use containers in html content areas

 5. Bind the click event to the span, and re-obtain the API return results for each click.

 6. Call the get request method that comes with uniapp and assign the text returned by the api to the container text

 7. You can set the onload method to request the api to obtain the content when the page is generated.

 8. Run it in the browser and check it out

 Each time you click on the text, you will re-request the API to switch to new text.

Guess you like

Origin blog.csdn.net/p_s_p/article/details/130880583