Introduction to fetch their differences and axios

fetch (javascript native in)
  • To fetch a manual data formatting, but axios data is internally formatted
  • Method fetch get request data, parameters to be directly connected to the url
  • There are three format data fetch processing method
    1. .json () json format type data, converts json string type objects into json
    2. .text () formatted text
    3. .blob () formatted binary data
  • If you write post fetch request, there are pit, carrying data according to the official website of the document there is a problem
  • fetch post processing
    1. Set request header
    2. The parameters to carry new URLSearchPrams
axios and fetch the requested data type is not jsonp

with

  • axios and fetch are based on the promise asynchronous
  • Both have get, post request method, etc.

different

  • axios have the results of our request to conduct a repackaged ((Let improved safety); fetch bare no direct exposure data package

Guess you like

Origin blog.csdn.net/HelloWord182/article/details/93341680