Axios plug-ins and loading implementations

Source: Internet
Author: User

Delete' Axios ' does not need to use Vue.use () to have the install method in Vue, the use method is required to return a Promise object when Vue is using Axios. You can use the. Then method in the data of the component to define a container to receive data, and then use this when mounted. The data container name to receive the data received by Axios.
Alternatively, you can use Stroe in Vuex to receive this data and then use this in this component by using the Vuex method mapstate and so on where you need to use it. $stroe way to use the stored data. Data sharing is realized. The implementation of loading is based on the action performed before the request to the page Ajax is successful, and the default loading effect then changes the state of the loading after the request succeeds.
// The cache is generally called when the cache is processed more than 500 milliseconds using caching.
We can use the loading method to mount a method in the instance of Vue, such as vue.prototype.loading={}, and then use it on a global basis.

Axios plug-ins and loading implementations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.