当前位置:   article > 正文

vue之axios取mock数据_axios mock

axios mock

在src\utils\axios.js中复制以下代码,如果没有这样的文需要建一个。(直接粘贴复制不用客气)

  1. // import axios from "axios";
  2. // import qs from 'qs'
  3. /* axios v0.21.0 | (c) 2020 by Matt Zabriskie */
  4. (function webpackUniversalModuleDefinition(root, factory) {
  5.   if (typeof exports === 'object' && typeof module === 'object') { module.exports = factory() } else if (typeof define === 'function' && define.amd) { define([], factory) } else if (typeof exports === 'object') { exports['axios'] = factory() } else { root['axios'] = factory() }
  6. })(this, function() {
  7.   return /** ****/ (function(modules) { // webpackBootstrap
  8.     /** ****/   // The module cache
  9.     /** ****/   var installedModules = {}
  10.     /** ****/
  11.     /** ****/   // The require function
  12.     /** ****/   function __webpack_require__(moduleId) {
  13.       /** ****/
  14.       /** ****/         // Check if module is in cache
  15.       /** ****/         if (installedModules[moduleId])
  16.       /** ****/             { return installedModules[moduleId].exports }
  17.       /** ****/
  18.       /** ****/         // Create a new module (and put it into the cache)
  19.       /** ****/         var module = installedModules[moduleId] = {
  20.         /** ****/           exports: {},
  21.         /** ****/           id: moduleId,
  22.         /** ****/           loaded: false
  23.         /** ****/       }
  24.       /** ****/
  25.       /** ****/         // Execute the module function
  26.       /** ****/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__)
  27.       /** ****/
  28.       /** ****/         // Flag the module as loaded
  29.       /** ****/         module.loaded = true
  30.       /** ****/
  31.       /** ****/         // Return the exports of the module
  32.       /** ****/         return module.exports
  33.       /** ****/     }
  34.     /** ****/
  35.     /** ****/
  36.     /** ****/   // expose the modules object (__webpack_modules__)
  37.     /** ****/   __webpack_require__.m = modules
  38.     /** ****/
  39.     /** ****/   // expose the module cache
  40.     /** ****/   __webpack_require__.c = installedModules
  41.     /** ****/
  42.     /** ****/   // __webpack_public_path__
  43.     /** ****/   __webpack_require__.p = ''
  44.     /** ****/
  45.     /** ****/   // Load entry module and return exports
  46.     /** ****/   return __webpack_require__(0)
  47.     /** ****/ })([
  48.     /* 0 */
  49.     /***/ function(module, exports, __webpack_require__) {
  50.       module.exports = __webpack_require__(1)
  51.       /***/ },
  52.     /* 1 */
  53.     /***/ function(module, exports, __webpack_require__) {
  54.       'use strict'
  55.       var utils = __webpack_require__(2)
  56.       var bind = __webpack_require__(3)
  57.       var Axios = __webpack_require__(4)
  58.       var mergeConfig = __webpack_require__(22)
  59.       var defaults = __webpack_require__(10)
  60.       /**
  61.      * Create an instance of Axios
  62.      *
  63.      * @param {Object} defaultConfig The default config for the instance
  64.      * @return {Axios} A new instance of Axios
  65.      */
  66.       function createInstance(defaultConfig) {
  67.       var context = new Axios(defaultConfig)
  68.       var instance = bind(Axios.prototype.request, context)
  69.       // Copy axios.prototype to instance
  70.       utils.extend(instance, Axios.prototype, context)
  71.       // Copy context to instance
  72.       utils.extend(instance, context)
  73.       return instance
  74.       }
  75.       // Create the default instance to be exported
  76.       var axios = createInstance(defaults)
  77.       // Expose Axios class to allow class inheritance
  78.       axios.Axios = Axios
  79.       // Factory for creating new instances
  80.       axios.create = function create(instanceConfig) {
  81.       return createInstance(mergeConfig(axios.defaults, instanceConfig))
  82.       }
  83.       // Expose Cancel & CancelToken
  84.       axios.Cancel = __webpack_require__(23)
  85.       axios.CancelToken = __webpack_require__(24)
  86.       axios.isCancel = __webpack_require__(9)
  87.       // Expose all/spread
  88.       axios.all = function all(promises) {
  89.       return Promise.all(promises)
  90.       }
  91.       axios.spread = __webpack_require__(25)
  92.       module.exports = axios
  93.       // Allow use of default import syntax in TypeScript
  94.       module.exports.default = axios
  95.       /***/ },
  96.     /* 2 */
  97.     /***/ function(module, exports, __webpack_require__) {
  98.       'use strict'
  99.       var bind = __webpack_require__(3)
  100.       /*global toString:true*/
  101.       // utils is a library of generic helper functions non-specific to axios
  102.       var toString = Object.prototype.toString
  103.       /**
  104.      * Determine if a value is an Array
  105.      *
  106.      * @param {Object} val The value to test
  107.      * @returns {boolean} True if value is an Array, otherwise false
  108.      */
  109.       function isArray(val) {
  110.       return toString.call(val) === '[object Array]'
  111.       }
  112.       /**
  113.      * Determine if a value is undefined
  114.      *
  115.      * @param {Object} val The value to test
  116.      * @returns {boolean} True if the value is undefined, otherwise false
  117.      */
  118.       function isUndefined(val) {
  119.       return typeof val === 'undefined'
  120.       }
  121.       /**
  122.      * Determine if a value is a Buffer
  123.      *
  124.      * @param {Object} val The value to test
  125.      * @returns {boolean} True if value is a Buffer, otherwise false
  126.      */
  127.       function isBuffer(val) {
  128.       return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) &&
  129.         typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val)
  130.       }
  131.       /**
  132.      * Determine if a value is an ArrayBuffer
  133.      *
  134.      * @param {Object} val The value to test
  135.      * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  136.      */
  137.       function isArrayBuffer(val) {
  138.       return toString.call(val) === '[object ArrayBuffer]'
  139.       }
  140.       /**
  141.      * Determine if a value is a FormData
  142.      *
  143.      * @param {Object} val The value to test
  144.      * @returns {boolean} True if value is an FormData, otherwise false
  145.      */
  146.       function isFormData(val) {
  147.       return (typeof FormData !== 'undefined') && (val instanceof FormData)
  148.       }
  149.       /**
  150.      * Determine if a value is a view on an ArrayBuffer
  151.      *
  152.      * @param {Object} val The value to test
  153.      * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  154.      */
  155.       function isArrayBufferView(val) {
  156.       var result
  157.       if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  158.         result = ArrayBuffer.isView(val)
  159.       } else {
  160.         result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer)
  161.       }
  162.       return result
  163.       }
  164.       /**
  165.      * Determine if a value is a String
  166.      *
  167.      * @param {Object} val The value to test
  168.      * @returns {boolean} True if value is a String, otherwise false
  169.      */
  170.       function isString(val) {
  171.       return typeof val === 'string'
  172.       }
  173.       /**
  174.      * Determine if a value is a Number
  175.      *
  176.      * @param {Object} val The value to test
  177.      * @returns {boolean} True if value is a Number, otherwise false
  178.      */
  179.       function isNumber(val) {
  180.       return typeof val === 'number'
  181.       }
  182.       /**
  183.      * Determine if a value is an Object
  184.      *
  185.      * @param {Object} val The value to test
  186.      * @returns {boolean} True if value is an Object, otherwise false
  187.      */
  188.       function isObject(val) {
  189.       return val !== null && typeof val === 'object'
  190.       }
  191.       /**
  192.      * Determine if a value is a plain Object
  193.      *
  194.      * @param {Object} val The value to test
  195.      * @return {boolean} True if value is a plain Object, otherwise false
  196.      */
  197.       function isPlainObject(val) {
  198.       if (toString.call(val) !== '[object Object]') {
  199.         return false
  200.       }
  201.       var prototype = Object.getPrototypeOf(val)
  202.       return prototype === null || prototype === Object.prototype
  203.       }
  204.       /**
  205.      * Determine if a value is a Date
  206.      *
  207.      * @param {Object} val The value to test
  208.      * @returns {boolean} True if value is a Date, otherwise false
  209.      */
  210.       function isDate(val) {
  211.       return toString.call(val) === '[object Date]'
  212.       }
  213.       /**
  214.      * Determine if a value is a File
  215.      *
  216.      * @param {Object} val The value to test
  217.      * @returns {boolean} True if value is a File, otherwise false
  218.      */
  219.       function isFile(val) {
  220.       return toString.call(val) === '[object File]'
  221.       }
  222.       /**
  223.      * Determine if a value is a Blob
  224.      *
  225.      * @param {Object} val The value to test
  226.      * @returns {boolean} True if value is a Blob, otherwise false
  227.      */
  228.       function isBlob(val) {
  229.       return toString.call(val) === '[object Blob]'
  230.       }
  231.       /**
  232.      * Determine if a value is a Function
  233.      *
  234.      * @param {Object} val The value to test
  235.      * @returns {boolean} True if value is a Function, otherwise false
  236.      */
  237.       function isFunction(val) {
  238.       return toString.call(val) === '[object Function]'
  239.       }
  240.       /**
  241.      * Determine if a value is a Stream
  242.      *
  243.      * @param {Object} val The value to test
  244.      * @returns {boolean} True if value is a Stream, otherwise false
  245.      */
  246.       function isStream(val) {
  247.       return isObject(val) && isFunction(val.pipe)
  248.       }
  249.       /**
  250.      * Determine if a value is a URLSearchParams object
  251.      *
  252.      * @param {Object} val The value to test
  253.      * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  254.      */
  255.       function isURLSearchParams(val) {
  256.       return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams
  257.       }
  258.       /**
  259.      * Trim excess whitespace off the beginning and end of a string
  260.      *
  261.      * @param {String} str The String to trim
  262.      * @returns {String} The String freed of excess whitespace
  263.      */
  264.       function trim(str) {
  265.       return str.replace(/^\s*/, '').replace(/\s*$/, '')
  266.       }
  267.       /**
  268.      * Determine if we're running in a standard browser environment
  269.      *
  270.      * This allows axios to run in a web worker, and react-native.
  271.      * Both environments support XMLHttpRequest, but not fully standard globals.
  272.      *
  273.      * web workers:
  274.      *  typeof window -> undefined
  275.      *  typeof document -> undefined
  276.      *
  277.      * react-native:
  278.      *  navigator.product -> 'ReactNative'
  279.      * nativescript
  280.      *  navigator.product -> 'NativeScript' or 'NS'
  281.      */
  282.       function isStandardBrowserEnv() {
  283.       if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  284.                                                navigator.product === 'NativeScript' ||
  285.                                                navigator.product === 'NS')) {
  286.         return false
  287.       }
  288.       return (
  289.         typeof window !== 'undefined' &&
  290.         typeof document !== 'undefined'
  291.       )
  292.       }
  293.       /**
  294.      * Iterate over an Array or an Object invoking a function for each item.
  295.      *
  296.      * If `obj` is an Array callback will be called passing
  297.      * the value, index, and complete array for each item.
  298.      *
  299.      * If 'obj' is an Object callback will be called passing
  300.      * the value, key, and complete object for each property.
  301.      *
  302.      * @param {Object|Array} obj The object to iterate
  303.      * @param {Function} fn The callback to invoke for each item
  304.      */
  305.       function forEach(obj, fn) {
  306.       // Don't bother if no value provided
  307.       if (obj === null || typeof obj === 'undefined') {
  308.         return
  309.       }
  310.       // Force an array if not already something iterable
  311.       if (typeof obj !== 'object') {
  312.         /*eslint no-param-reassign:0*/
  313.         obj = [obj]
  314.       }
  315.       if (isArray(obj)) {
  316.         // Iterate over array values
  317.         for (var i = 0, l = obj.length; i < l; i++) {
  318.           fn.call(null, obj[i], i, obj)
  319.         }
  320.       } else {
  321.         // Iterate over object keys
  322.         for (var key in obj) {
  323.           if (Object.prototype.hasOwnProperty.call(obj, key)) {
  324.             fn.call(null, obj[key], key, obj)
  325.           }
  326.         }
  327.       }
  328.       }
  329.       /**
  330.      * Accepts varargs expecting each argument to be an object, then
  331.      * immutably merges the properties of each object and returns result.
  332.      *
  333.      * When multiple objects contain the same key the later object in
  334.      * the arguments list will take precedence.
  335.      *
  336.      * Example:
  337.      *
  338.      * ```js
  339.      * var result = merge({foo: 123}, {foo: 456});
  340.      * console.log(result.foo); // outputs 456
  341.      * ```
  342.      *
  343.      * @param {Object} obj1 Object to merge
  344.      * @returns {Object} Result of all merge properties
  345.      */
  346.       function merge(/* obj1, obj2, obj3, ... */) {
  347.       var result = {}
  348.       function assignValue(val, key) {
  349.         if (isPlainObject(result[key]) && isPlainObject(val)) {
  350.           result[key] = merge(result[key], val)
  351.         } else if (isPlainObject(val)) {
  352.           result[key] = merge({}, val)
  353.         } else if (isArray(val)) {
  354.           result[key] = val.slice()
  355.         } else {
  356.           result[key] = val
  357.         }
  358.       }
  359.       for (var i = 0, l = arguments.length; i < l; i++) {
  360.         forEach(arguments[i], assignValue)
  361.       }
  362.       return result
  363.       }
  364.       /**
  365.      * Extends object a by mutably adding to it the properties of object b.
  366.      *
  367.      * @param {Object} a The object to be extended
  368.      * @param {Object} b The object to copy properties from
  369.      * @param {Object} thisArg The object to bind function to
  370.      * @return {Object} The resulting value of object a
  371.      */
  372.       function extend(a, b, thisArg) {
  373.       forEach(b, function assignValue(val, key) {
  374.         if (thisArg && typeof val === 'function') {
  375.           a[key] = bind(val, thisArg)
  376.         } else {
  377.           a[key] = val
  378.         }
  379.       })
  380.       return a
  381.       }
  382.       /**
  383.      * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
  384.      *
  385.      * @param {string} content with BOM
  386.      * @return {string} content value without BOM
  387.      */
  388.       function stripBOM(content) {
  389.       if (content.charCodeAt(0) === 0xFEFF) {
  390.         content = content.slice(1)
  391.       }
  392.       return content
  393.       }
  394.       module.exports = {
  395.       isArray: isArray,
  396.       isArrayBuffer: isArrayBuffer,
  397.       isBuffer: isBuffer,
  398.       isFormData: isFormData,
  399.       isArrayBufferView: isArrayBufferView,
  400.       isString: isString,
  401.       isNumber: isNumber,
  402.       isObject: isObject,
  403.       isPlainObject: isPlainObject,
  404.       isUndefined: isUndefined,
  405.       isDate: isDate,
  406.       isFile: isFile,
  407.       isBlob: isBlob,
  408.       isFunction: isFunction,
  409.       isStream: isStream,
  410.       isURLSearchParams: isURLSearchParams,
  411.       isStandardBrowserEnv: isStandardBrowserEnv,
  412.       forEach: forEach,
  413.       merge: merge,
  414.       extend: extend,
  415.       trim: trim,
  416.       stripBOM: stripBOM
  417.       }
  418.       /***/ },
  419.     /* 3 */
  420.     /***/ function(module, exports) {
  421.       'use strict'
  422.       module.exports = function bind(fn, thisArg) {
  423.       return function wrap() {
  424.         var args = new Array(arguments.length)
  425.         for (var i = 0; i < args.length; i++) {
  426.           args[i] = arguments[i]
  427.         }
  428.         return fn.apply(thisArg, args)
  429.       }
  430.       }
  431.       /***/ },
  432.     /* 4 */
  433.     /***/ function(module, exports, __webpack_require__) {
  434.       'use strict'
  435.       var utils = __webpack_require__(2)
  436.       var buildURL = __webpack_require__(5)
  437.       var InterceptorManager = __webpack_require__(6)
  438.       var dispatchRequest = __webpack_require__(7)
  439.       var mergeConfig = __webpack_require__(22)
  440.       /**
  441.      * Create a new instance of Axios
  442.      *
  443.      * @param {Object} instanceConfig The default config for the instance
  444.      */
  445.       function Axios(instanceConfig) {
  446.       this.defaults = instanceConfig
  447.       this.interceptors = {
  448.         request: new InterceptorManager(),
  449.         response: new InterceptorManager()
  450.       }
  451.       }
  452.       /**
  453.      * Dispatch a request
  454.      *
  455.      * @param {Object} config The config specific for this request (merged with this.defaults)
  456.      */
  457.       Axios.prototype.request = function request(config) {
  458.       /*eslint no-param-reassign:0*/
  459.       // Allow for axios('example/url'[, config]) a la fetch API
  460.       if (typeof config === 'string') {
  461.         config = arguments[1] || {}
  462.         config.url = arguments[0]
  463.       } else {
  464.         config = config || {}
  465.       }
  466.       config = mergeConfig(this.defaults, config)
  467.       // Set config.method
  468.       if (config.method) {
  469.         config.method = config.method.toLowerCase()
  470.       } else if (this.defaults.method) {
  471.         config.method = this.defaults.method.toLowerCase()
  472.       } else {
  473.         config.method = 'get'
  474.       }
  475.       // Hook up interceptors middleware
  476.       var chain = [dispatchRequest, undefined]
  477.       var promise = Promise.resolve(config)
  478.       this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  479.         chain.unshift(interceptor.fulfilled, interceptor.rejected)
  480.       })
  481.       this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  482.         chain.push(interceptor.fulfilled, interceptor.rejected)
  483.       })
  484.       while (chain.length) {
  485.         promise = promise.then(chain.shift(), chain.shift())
  486.       }
  487.       return promise
  488.       }
  489.       Axios.prototype.getUri = function getUri(config) {
  490.       config = mergeConfig(this.defaults, config)
  491.       return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '')
  492.       }
  493.       // Provide aliases for supported request methods
  494.       utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  495.       /*eslint func-names:0*/
  496.       Axios.prototype[method] = function(url, config) {
  497.         return this.request(mergeConfig(config || {}, {
  498.           method: method,
  499.           url: url,
  500.           data: (config || {}).data
  501.         }))
  502.       }
  503.       })
  504.       utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  505.       /*eslint func-names:0*/
  506.       Axios.prototype[method] = function(url, data, config) {
  507.         return this.request(mergeConfig(config || {}, {
  508.           method: method,
  509.           url: url,
  510.           data: data
  511.         }))
  512.       }
  513.       })
  514.       module.exports = Axios
  515.       /***/ },
  516.     /* 5 */
  517.     /***/ function(module, exports, __webpack_require__) {
  518.       'use strict'
  519.       var utils = __webpack_require__(2)
  520.       function encode(val) {
  521.       return encodeURIComponent(val)
  522.         .replace(/%3A/gi, ':')
  523.         .replace(/%24/g, '$')
  524.         .replace(/%2C/gi, ',')
  525.         .replace(/%20/g, '+')
  526.         .replace(/%5B/gi, '[')
  527.         .replace(/%5D/gi, ']')
  528.       }
  529.       /**
  530.      * Build a URL by appending params to the end
  531.      *
  532.      * @param {string} url The base of the url (e.g., http://www.google.com)
  533.      * @param {object} [params] The params to be appended
  534.      * @returns {string} The formatted url
  535.      */
  536.       module.exports = function buildURL(url, params, paramsSerializer) {
  537.       /*eslint no-param-reassign:0*/
  538.       if (!params) {
  539.         return url
  540.       }
  541.       var serializedParams
  542.       if (paramsSerializer) {
  543.         serializedParams = paramsSerializer(params)
  544.       } else if (utils.isURLSearchParams(params)) {
  545.         serializedParams = params.toString()
  546.       } else {
  547.         var parts = []
  548.         utils.forEach(params, function serialize(val, key) {
  549.           if (val === null || typeof val === 'undefined') {
  550.             return
  551.           }
  552.           if (utils.isArray(val)) {
  553.             key = key + '[]'
  554.           } else {
  555.             val = [val]
  556.           }
  557.           utils.forEach(val, function parseValue(v) {
  558.             if (utils.isDate(v)) {
  559.               v = v.toISOString()
  560.             } else if (utils.isObject(v)) {
  561.               v = JSON.stringify(v)
  562.             }
  563.             parts.push(encode(key) + '=' + encode(v))
  564.           })
  565.         })
  566.         serializedParams = parts.join('&')
  567.       }
  568.       if (serializedParams) {
  569.         var hashmarkIndex = url.indexOf('#')
  570.         if (hashmarkIndex !== -1) {
  571.           url = url.slice(0, hashmarkIndex)
  572.         }
  573.         url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams
  574.       }
  575.       return url
  576.       }
  577.       /***/ },
  578.     /* 6 */
  579.     /***/ function(module, exports, __webpack_require__) {
  580.       'use strict'
  581.       var utils = __webpack_require__(2)
  582.       function InterceptorManager() {
  583.       this.handlers = []
  584.       }
  585.       /**
  586.      * Add a new interceptor to the stack
  587.      *
  588.      * @param {Function} fulfilled The function to handle `then` for a `Promise`
  589.      * @param {Function} rejected The function to handle `reject` for a `Promise`
  590.      *
  591.      * @return {Number} An ID used to remove interceptor later
  592.      */
  593.       InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  594.       this.handlers.push({
  595.         fulfilled: fulfilled,
  596.         rejected: rejected
  597.       })
  598.       return this.handlers.length - 1
  599.       }
  600.       /**
  601.      * Remove an interceptor from the stack
  602.      *
  603.      * @param {Number} id The ID that was returned by `use`
  604.      */
  605.       InterceptorManager.prototype.eject = function eject(id) {
  606.       if (this.handlers[id]) {
  607.         this.handlers[id] = null
  608.       }
  609.       }
  610.       /**
  611.      * Iterate over all the registered interceptors
  612.      *
  613.      * This method is particularly useful for skipping over any
  614.      * interceptors that may have become `null` calling `eject`.
  615.      *
  616.      * @param {Function} fn The function to call for each interceptor
  617.      */
  618.       InterceptorManager.prototype.forEach = function forEach(fn) {
  619.       utils.forEach(this.handlers, function forEachHandler(h) {
  620.         if (h !== null) {
  621.           fn(h)
  622.         }
  623.       })
  624.       }
  625.       module.exports = InterceptorManager
  626.       /***/ },
  627.     /* 7 */
  628.     /***/ function(module, exports, __webpack_require__) {
  629.       'use strict'
  630.       var utils = __webpack_require__(2)
  631.       var transformData = __webpack_require__(8)
  632.       var isCancel = __webpack_require__(9)
  633.       var defaults = __webpack_require__(10)
  634.       /**
  635.      * Throws a `Cancel` if cancellation has been requested.
  636.      */
  637.       function throwIfCancellationRequested(config) {
  638.       if (config.cancelToken) {
  639.         config.cancelToken.throwIfRequested()
  640.       }
  641.       }
  642.       /**
  643.      * Dispatch a request to the server using the configured adapter.
  644.      *
  645.      * @param {object} config The config that is to be used for the request
  646.      * @returns {Promise} The Promise to be fulfilled
  647.      */
  648.       module.exports = function dispatchRequest(config) {
  649.       throwIfCancellationRequested(config)
  650.       // Ensure headers exist
  651.       config.headers = config.headers || {}
  652.       // Transform request data
  653.       config.data = transformData(
  654.         config.data,
  655.         config.headers,
  656.         config.transformRequest
  657.       )
  658.       // Flatten headers
  659.       config.headers = utils.merge(
  660.         config.headers.common || {},
  661.         config.headers[config.method] || {},
  662.         config.headers
  663.       )
  664.       utils.forEach(
  665.         ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  666.         function cleanHeaderConfig(method) {
  667.           delete config.headers[method]
  668.         }
  669.       )
  670.       var adapter = config.adapter || defaults.adapter
  671.       return adapter(config).then(function onAdapterResolution(response) {
  672.         throwIfCancellationRequested(config)
  673.         // Transform response data
  674.         response.data = transformData(
  675.           response.data,
  676.           response.headers,
  677.           config.transformResponse
  678.         )
  679.         return response
  680.       }, function onAdapterRejection(reason) {
  681.         if (!isCancel(reason)) {
  682.           throwIfCancellationRequested(config)
  683.           // Transform response data
  684.           if (reason && reason.response) {
  685.             reason.response.data = transformData(
  686.               reason.response.data,
  687.               reason.response.headers,
  688.               config.transformResponse
  689.             )
  690.           }
  691.         }
  692.         return Promise.reject(reason)
  693.       })
  694.       }
  695.       /***/ },
  696.     /* 8 */
  697.     /***/ function(module, exports, __webpack_require__) {
  698.       'use strict'
  699.       var utils = __webpack_require__(2)
  700.       /**
  701.      * Transform the data for a request or a response
  702.      *
  703.      * @param {Object|String} data The data to be transformed
  704.      * @param {Array} headers The headers for the request or response
  705.      * @param {Array|Function} fns A single function or Array of functions
  706.      * @returns {*} The resulting transformed data
  707.      */
  708.       module.exports = function transformData(data, headers, fns) {
  709.       /*eslint no-param-reassign:0*/
  710.       utils.forEach(fns, function transform(fn) {
  711.         data = fn(data, headers)
  712.       })
  713.       return data
  714.       }
  715.       /***/ },
  716.     /* 9 */
  717.     /***/ function(module, exports) {
  718.       'use strict'
  719.       module.exports = function isCancel(value) {
  720.       return !!(value && value.__CANCEL__)
  721.       }
  722.       /***/ },
  723.     /* 10 */
  724.     /***/ function(module, exports, __webpack_require__) {
  725.       'use strict'
  726.       var utils = __webpack_require__(2)
  727.       var normalizeHeaderName = __webpack_require__(11)
  728.       var DEFAULT_CONTENT_TYPE = {
  729.       'Content-Type': 'application/x-www-form-urlencoded'
  730.       }
  731.       function setContentTypeIfUnset(headers, value) {
  732.       if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  733.         headers['Content-Type'] = value
  734.       }
  735.       }
  736.       function getDefaultAdapter() {
  737.       var adapter
  738.       if (typeof XMLHttpRequest !== 'undefined') {
  739.         // For browsers use XHR adapter
  740.         adapter = __webpack_require__(12)
  741.       } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  742.         // For node use HTTP adapter
  743.         adapter = __webpack_require__(12)
  744.       }
  745.       return adapter
  746.       }
  747.       var defaults = {
  748.       adapter: getDefaultAdapter(),
  749.       transformRequest: [function transformRequest(data, headers) {
  750.         normalizeHeaderName(headers, 'Accept')
  751.         normalizeHeaderName(headers, 'Content-Type')
  752.         if (utils.isFormData(data) ||
  753.           utils.isArrayBuffer(data) ||
  754.           utils.isBuffer(data) ||
  755.           utils.isStream(data) ||
  756.           utils.isFile(data) ||
  757.           utils.isBlob(data)
  758.         ) {
  759.           return data
  760.         }
  761.         if (utils.isArrayBufferView(data)) {
  762.           return data.buffer
  763.         }
  764.         if (utils.isURLSearchParams(data)) {
  765.           setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8')
  766.           return data.toString()
  767.         }
  768.         if (utils.isObject(data)) {
  769.           setContentTypeIfUnset(headers, 'application/json;charset=utf-8')
  770.           return JSON.stringify(data)
  771.         }
  772.         return data
  773.       }],
  774.       transformResponse: [function transformResponse(data) {
  775.         /*eslint no-param-reassign:0*/
  776.         if (typeof data === 'string') {
  777.           try {
  778.             data = JSON.parse(data)
  779.           } catch (e) { /* Ignore */ }
  780.         }
  781.         return data
  782.       }],
  783.       /**
  784.        * A timeout in milliseconds to abort a request. If set to 0 (default) a
  785.        * timeout is not created.
  786.        */
  787.       timeout: 0,
  788.       xsrfCookieName: 'XSRF-TOKEN',
  789.       xsrfHeaderName: 'X-XSRF-TOKEN',
  790.       maxContentLength: -1,
  791.       maxBodyLength: -1,
  792.       validateStatus: function validateStatus(status) {
  793.         return status >= 200 && status < 300
  794.       }
  795.       }
  796.       defaults.headers = {
  797.       common: {
  798.         'Accept': 'application/json, text/plain, */*'
  799.       }
  800.       }
  801.       utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  802.       defaults.headers[method] = {}
  803.       })
  804.       utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  805.       defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE)
  806.       })
  807.       module.exports = defaults
  808.       /***/ },
  809.     /* 11 */
  810.     /***/ function(module, exports, __webpack_require__) {
  811.       'use strict'
  812.       var utils = __webpack_require__(2)
  813.       module.exports = function normalizeHeaderName(headers, normalizedName) {
  814.       utils.forEach(headers, function processHeader(value, name) {
  815.         if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  816.           headers[normalizedName] = value
  817.           delete headers[name]
  818.         }
  819.       })
  820.       }
  821.       /***/ },
  822.     /* 12 */
  823.     /***/ function(module, exports, __webpack_require__) {
  824.       'use strict'
  825.       var utils = __webpack_require__(2)
  826.       var settle = __webpack_require__(13)
  827.       var cookies = __webpack_require__(16)
  828.       var buildURL = __webpack_require__(5)
  829.       var buildFullPath = __webpack_require__(17)
  830.       var parseHeaders = __webpack_require__(20)
  831.       var isURLSameOrigin = __webpack_require__(21)
  832.       var createError = __webpack_require__(14)
  833.       module.exports = function xhrAdapter(config) {
  834.       return new Promise(function dispatchXhrRequest(resolve, reject) {
  835.         var requestData = config.data
  836.         var requestHeaders = config.headers
  837.         if (utils.isFormData(requestData)) {
  838.           delete requestHeaders['Content-Type'] // Let the browser set it
  839.         }
  840.         var request = new XMLHttpRequest()
  841.         // HTTP basic authentication
  842.         if (config.auth) {
  843.           var username = config.auth.username || ''
  844.           var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''
  845.           requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password)
  846.         }
  847.         var fullPath = buildFullPath(config.baseURL, config.url)
  848.         request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true)
  849.         // Set the request timeout in MS
  850.         request.timeout = config.timeout
  851.         // Listen for ready state
  852.         request.onreadystatechange = function handleLoad() {
  853.           if (!request || request.readyState !== 4) {
  854.             return
  855.           }
  856.           // The request errored out and we didn't get a response, this will be
  857.           // handled by onerror instead
  858.           // With one exception: request that using file: protocol, most browsers
  859.           // will return status as 0 even though it's a successful request
  860.           if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  861.             return
  862.           }
  863.           // Prepare the response
  864.           var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null
  865.           var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response
  866.           var response = {
  867.             data: responseData,
  868.             status: request.status,
  869.             statusText: request.statusText,
  870.             headers: responseHeaders,
  871.             config: config,
  872.             request: request
  873.           }
  874.           settle(resolve, reject, response)
  875.           // Clean up request
  876.           request = null
  877.         }
  878.         // Handle browser request cancellation (as opposed to a manual cancellation)
  879.         request.onabort = function handleAbort() {
  880.           if (!request) {
  881.             return
  882.           }
  883.           reject(createError('Request aborted', config, 'ECONNABORTED', request))
  884.           // Clean up request
  885.           request = null
  886.         }
  887.         // Handle low level network errors
  888.         request.onerror = function handleError() {
  889.           // Real errors are hidden from us by the browser
  890.           // onerror should only fire if it's a network error
  891.           reject(createError('Network Error', config, null, request))
  892.           // Clean up request
  893.           request = null
  894.         }
  895.         // Handle timeout
  896.         request.ontimeout = function handleTimeout() {
  897.           var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded'
  898.           if (config.timeoutErrorMessage) {
  899.             timeoutErrorMessage = config.timeoutErrorMessage
  900.           }
  901.           reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  902.             request))
  903.           // Clean up request
  904.           request = null
  905.         }
  906.         // Add xsrf header
  907.         // This is only done if running in a standard browser environment.
  908.         // Specifically not if we're in a web worker, or react-native.
  909.         if (utils.isStandardBrowserEnv()) {
  910.           // Add xsrf header
  911.           var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName
  912.             ? cookies.read(config.xsrfCookieName)
  913.             : undefined
  914.           if (xsrfValue) {
  915.             requestHeaders[config.xsrfHeaderName] = xsrfValue
  916.           }
  917.         }
  918.         // Add headers to the request
  919.         if ('setRequestHeader' in request) {
  920.           utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  921.             if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  922.               // Remove Content-Type if data is undefined
  923.               delete requestHeaders[key]
  924.             } else {
  925.               // Otherwise add header to the request
  926.               request.setRequestHeader(key, val)
  927.             }
  928.           })
  929.         }
  930.         // Add withCredentials to request if needed
  931.         if (!utils.isUndefined(config.withCredentials)) {
  932.           request.withCredentials = !!config.withCredentials
  933.         }
  934.         // Add responseType to request if needed
  935.         if (config.responseType) {
  936.           try {
  937.             request.responseType = config.responseType
  938.           } catch (e) {
  939.             // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  940.             // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  941.             if (config.responseType !== 'json') {
  942.               throw e
  943.             }
  944.           }
  945.         }
  946.         // Handle progress if needed
  947.         if (typeof config.onDownloadProgress === 'function') {
  948.           request.addEventListener('progress', config.onDownloadProgress)
  949.         }
  950.         // Not all browsers support upload events
  951.         if (typeof config.onUploadProgress === 'function' && request.upload) {
  952.           request.upload.addEventListener('progress', config.onUploadProgress)
  953.         }
  954.         if (config.cancelToken) {
  955.           // Handle cancellation
  956.           config.cancelToken.promise.then(function onCanceled(cancel) {
  957.             if (!request) {
  958.               return
  959.             }
  960.             request.abort()
  961.             reject(cancel)
  962.             // Clean up request
  963.             request = null
  964.           })
  965.         }
  966.         if (!requestData) {
  967.           requestData = null
  968.         }
  969.         // Send the request
  970.         request.send(requestData)
  971.       })
  972.       }
  973.       /***/ },
  974.     /* 13 */
  975.     /***/ function(module, exports, __webpack_require__) {
  976.       'use strict'
  977.       var createError = __webpack_require__(14)
  978.       /**
  979.      * Resolve or reject a Promise based on response status.
  980.      *
  981.      * @param {Function} resolve A function that resolves the promise.
  982.      * @param {Function} reject A function that rejects the promise.
  983.      * @param {object} response The response.
  984.      */
  985.       module.exports = function settle(resolve, reject, response) {
  986.       var validateStatus = response.config.validateStatus
  987.       if (!response.status || !validateStatus || validateStatus(response.status)) {
  988.         resolve(response)
  989.       } else {
  990.         reject(createError(
  991.           'Request failed with status code ' + response.status,
  992.           response.config,
  993.           null,
  994.           response.request,
  995.           response
  996.         ))
  997.       }
  998.       }
  999.       /***/ },
  1000.     /* 14 */
  1001.     /***/ function(module, exports, __webpack_require__) {
  1002.       'use strict'
  1003.       var enhanceError = __webpack_require__(15)
  1004.       /**
  1005.      * Create an Error with the specified message, config, error code, request and response.
  1006.      *
  1007.      * @param {string} message The error message.
  1008.      * @param {Object} config The config.
  1009.      * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1010.      * @param {Object} [request] The request.
  1011.      * @param {Object} [response] The response.
  1012.      * @returns {Error} The created error.
  1013.      */
  1014.       module.exports = function createError(message, config, code, request, response) {
  1015.       var error = new Error(message)
  1016.       return enhanceError(error, config, code, request, response)
  1017.       }
  1018.       /***/ },
  1019.     /* 15 */
  1020.     /***/ function(module, exports) {
  1021.       'use strict'
  1022.       /**
  1023.      * Update an Error with the specified config, error code, and response.
  1024.      *
  1025.      * @param {Error} error The error to update.
  1026.      * @param {Object} config The config.
  1027.      * @param {string} [code] The error code (for example, 'ECONNABORTED').
  1028.      * @param {Object} [request] The request.
  1029.      * @param {Object} [response] The response.
  1030.      * @returns {Error} The error.
  1031.      */
  1032.       module.exports = function enhanceError(error, config, code, request, response) {
  1033.       error.config = config
  1034.       if (code) {
  1035.         error.code = code
  1036.       }
  1037.       error.request = request
  1038.       error.response = response
  1039.       error.isAxiosError = true
  1040.       error.toJSON = function toJSON() {
  1041.         return {
  1042.           // Standard
  1043.           message: this.message,
  1044.           name: this.name,
  1045.           // Microsoft
  1046.           description: this.description,
  1047.           number: this.number,
  1048.           // Mozilla
  1049.           fileName: this.fileName,
  1050.           lineNumber: this.lineNumber,
  1051.           columnNumber: this.columnNumber,
  1052.           stack: this.stack,
  1053.           // Axios
  1054.           config: this.config,
  1055.           code: this.code
  1056.         }
  1057.       }
  1058.       return error
  1059.       }
  1060.       /***/ },
  1061.     /* 16 */
  1062.     /***/ function(module, exports, __webpack_require__) {
  1063.       'use strict'
  1064.       var utils = __webpack_require__(2)
  1065.       module.exports = (
  1066.       utils.isStandardBrowserEnv()
  1067.       // Standard browser envs support document.cookie
  1068.         ? (function standardBrowserEnv() {
  1069.           return {
  1070.             write: function write(name, value, expires, path, domain, secure) {
  1071.               var cookie = []
  1072.               cookie.push(name + '=' + encodeURIComponent(value))
  1073.               if (utils.isNumber(expires)) {
  1074.                 cookie.push('expires=' + new Date(expires).toGMTString())
  1075.               }
  1076.               if (utils.isString(path)) {
  1077.                 cookie.push('path=' + path)
  1078.               }
  1079.               if (utils.isString(domain)) {
  1080.                 cookie.push('domain=' + domain)
  1081.               }
  1082.               if (secure === true) {
  1083.                 cookie.push('secure')
  1084.               }
  1085.               document.cookie = cookie.join('; ')
  1086.             },
  1087.             read: function read(name) {
  1088.               var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'))
  1089.               return (match ? decodeURIComponent(match[3]) : null)
  1090.             },
  1091.             remove: function remove(name) {
  1092.               this.write(name, '', Date.now() - 86400000)
  1093.             }
  1094.           }
  1095.         })()
  1096.       // Non standard browser env (web workers, react-native) lack needed support.
  1097.         : (function nonStandardBrowserEnv() {
  1098.           return {
  1099.             write: function write() {},
  1100.             read: function read() { return null },
  1101.             remove: function remove() {}
  1102.           }
  1103.         })()
  1104.       )
  1105.       /***/ },
  1106.     /* 17 */
  1107.     /***/ function(module, exports, __webpack_require__) {
  1108.       'use strict'
  1109.       var isAbsoluteURL = __webpack_require__(18)
  1110.       var combineURLs = __webpack_require__(19)
  1111.       /**
  1112.      * Creates a new URL by combining the baseURL with the requestedURL,
  1113.      * only when the requestedURL is not already an absolute URL.
  1114.      * If the requestURL is absolute, this function returns the requestedURL untouched.
  1115.      *
  1116.      * @param {string} baseURL The base URL
  1117.      * @param {string} requestedURL Absolute or relative URL to combine
  1118.      * @returns {string} The combined full path
  1119.      */
  1120.       module.exports = function buildFullPath(baseURL, requestedURL) {
  1121.       if (baseURL && !isAbsoluteURL(requestedURL)) {
  1122.         return combineURLs(baseURL, requestedURL)
  1123.       }
  1124.       return requestedURL
  1125.       }
  1126.       /***/ },
  1127.     /* 18 */
  1128.     /***/ function(module, exports) {
  1129.       'use strict'
  1130.       /**
  1131.      * Determines whether the specified URL is absolute
  1132.      *
  1133.      * @param {string} url The URL to test
  1134.      * @returns {boolean} True if the specified URL is absolute, otherwise false
  1135.      */
  1136.       module.exports = function isAbsoluteURL(url) {
  1137.       // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1138.       // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1139.       // by any combination of letters, digits, plus, period, or hyphen.
  1140.       return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url)
  1141.       }
  1142.       /***/ },
  1143.     /* 19 */
  1144.     /***/ function(module, exports) {
  1145.       'use strict'
  1146.       /**
  1147.      * Creates a new URL by combining the specified URLs
  1148.      *
  1149.      * @param {string} baseURL The base URL
  1150.      * @param {string} relativeURL The relative URL
  1151.      * @returns {string} The combined URL
  1152.      */
  1153.       module.exports = function combineURLs(baseURL, relativeURL) {
  1154.       return relativeURL
  1155.         ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1156.         : baseURL
  1157.       }
  1158.       /***/ },
  1159.     /* 20 */
  1160.     /***/ function(module, exports, __webpack_require__) {
  1161.       'use strict'
  1162.       var utils = __webpack_require__(2)
  1163.       // Headers whose duplicates are ignored by node
  1164.       // c.f. https://nodejs.org/api/http.html#http_message_headers
  1165.       var ignoreDuplicateOf = [
  1166.       'age', 'authorization', 'content-length', 'content-type', 'etag',
  1167.       'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1168.       'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1169.       'referer', 'retry-after', 'user-agent'
  1170.       ]
  1171.       /**
  1172.      * Parse headers into an object
  1173.      *
  1174.      * ```
  1175.      * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1176.      * Content-Type: application/json
  1177.      * Connection: keep-alive
  1178.      * Transfer-Encoding: chunked
  1179.      * ```
  1180.      *
  1181.      * @param {String} headers Headers needing to be parsed
  1182.      * @returns {Object} Headers parsed into an object
  1183.      */
  1184.       module.exports = function parseHeaders(headers) {
  1185.       var parsed = {}
  1186.       var key
  1187.       var val
  1188.       var i
  1189.       if (!headers) { return parsed }
  1190.       utils.forEach(headers.split('\n'), function parser(line) {
  1191.         i = line.indexOf(':')
  1192.         key = utils.trim(line.substr(0, i)).toLowerCase()
  1193.         val = utils.trim(line.substr(i + 1))
  1194.         if (key) {
  1195.           if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1196.             return
  1197.           }
  1198.           if (key === 'set-cookie') {
  1199.             parsed[key] = (parsed[key] ? parsed[key] : []).concat([val])
  1200.           } else {
  1201.             parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val
  1202.           }
  1203.         }
  1204.       })
  1205.       return parsed
  1206.       }
  1207.       /***/ },
  1208.     /* 21 */
  1209.     /***/ function(module, exports, __webpack_require__) {
  1210.       'use strict'
  1211.       var utils = __webpack_require__(2)
  1212.       module.exports = (
  1213.       utils.isStandardBrowserEnv()
  1214.       // Standard browser envs have full support of the APIs needed to test
  1215.       // whether the request URL is of the same origin as current location.
  1216.         ? (function standardBrowserEnv() {
  1217.           var msie = /(msie|trident)/i.test(navigator.userAgent)
  1218.           var urlParsingNode = document.createElement('a')
  1219.           var originURL
  1220.           /**
  1221.         * Parse a URL to discover it's components
  1222.         *
  1223.         * @param {String} url The URL to be parsed
  1224.         * @returns {Object}
  1225.         */
  1226.           function resolveURL(url) {
  1227.             var href = url
  1228.             if (msie) {
  1229.             // IE needs attribute set twice to normalize properties
  1230.               urlParsingNode.setAttribute('href', href)
  1231.               href = urlParsingNode.href
  1232.             }
  1233.             urlParsingNode.setAttribute('href', href)
  1234.             // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1235.             return {
  1236.               href: urlParsingNode.href,
  1237.               protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1238.               host: urlParsingNode.host,
  1239.               search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1240.               hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1241.               hostname: urlParsingNode.hostname,
  1242.               port: urlParsingNode.port,
  1243.               pathname: (urlParsingNode.pathname.charAt(0) === '/')
  1244.                 ? urlParsingNode.pathname
  1245.                 : '/' + urlParsingNode.pathname
  1246.             }
  1247.           }
  1248.           originURL = resolveURL(window.location.href)
  1249.           /**
  1250.         * Determine if a URL shares the same origin as the current location
  1251.         *
  1252.         * @param {String} requestURL The URL to test
  1253.         * @returns {boolean} True if URL shares the same origin, otherwise false
  1254.         */
  1255.           return function isURLSameOrigin(requestURL) {
  1256.             var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL
  1257.             return (parsed.protocol === originURL.protocol &&
  1258.                 parsed.host === originURL.host)
  1259.           }
  1260.         })()
  1261.       // Non standard browser envs (web workers, react-native) lack needed support.
  1262.         : (function nonStandardBrowserEnv() {
  1263.           return function isURLSameOrigin() {
  1264.             return true
  1265.           }
  1266.         })()
  1267.       )
  1268.       /***/ },
  1269.     /* 22 */
  1270.     /***/ function(module, exports, __webpack_require__) {
  1271.       'use strict'
  1272.       var utils = __webpack_require__(2)
  1273.       /**
  1274.      * Config-specific merge-function which creates a new config-object
  1275.      * by merging two configuration objects together.
  1276.      *
  1277.      * @param {Object} config1
  1278.      * @param {Object} config2
  1279.      * @returns {Object} New object resulting from merging config2 to config1
  1280.      */
  1281.       module.exports = function mergeConfig(config1, config2) {
  1282.       // eslint-disable-next-line no-param-reassign
  1283.       config2 = config2 || {}
  1284.       var config = {}
  1285.       var valueFromConfig2Keys = ['url', 'method', 'data']
  1286.       var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params']
  1287.       var defaultToConfig2Keys = [
  1288.         'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
  1289.         'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  1290.         'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
  1291.         'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
  1292.         'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
  1293.       ]
  1294.       var directMergeKeys = ['validateStatus']
  1295.       function getMergedValue(target, source) {
  1296.         if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
  1297.           return utils.merge(target, source)
  1298.         } else if (utils.isPlainObject(source)) {
  1299.           return utils.merge({}, source)
  1300.         } else if (utils.isArray(source)) {
  1301.           return source.slice()
  1302.         }
  1303.         return source
  1304.       }
  1305.       function mergeDeepProperties(prop) {
  1306.         if (!utils.isUndefined(config2[prop])) {
  1307.           config[prop] = getMergedValue(config1[prop], config2[prop])
  1308.         } else if (!utils.isUndefined(config1[prop])) {
  1309.           config[prop] = getMergedValue(undefined, config1[prop])
  1310.         }
  1311.       }
  1312.       utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  1313.         if (!utils.isUndefined(config2[prop])) {
  1314.           config[prop] = getMergedValue(undefined, config2[prop])
  1315.         }
  1316.       })
  1317.       utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties)
  1318.       utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  1319.         if (!utils.isUndefined(config2[prop])) {
  1320.           config[prop] = getMergedValue(undefined, config2[prop])
  1321.         } else if (!utils.isUndefined(config1[prop])) {
  1322.           config[prop] = getMergedValue(undefined, config1[prop])
  1323.         }
  1324.       })
  1325.       utils.forEach(directMergeKeys, function merge(prop) {
  1326.         if (prop in config2) {
  1327.           config[prop] = getMergedValue(config1[prop], config2[prop])
  1328.         } else if (prop in config1) {
  1329.           config[prop] = getMergedValue(undefined, config1[prop])
  1330.         }
  1331.       })
  1332.       var axiosKeys = valueFromConfig2Keys
  1333.         .concat(mergeDeepPropertiesKeys)
  1334.         .concat(defaultToConfig2Keys)
  1335.         .concat(directMergeKeys)
  1336.       var otherKeys = Object
  1337.         .keys(config1)
  1338.         .concat(Object.keys(config2))
  1339.         .filter(function filterAxiosKeys(key) {
  1340.           return axiosKeys.indexOf(key) === -1
  1341.         })
  1342.       utils.forEach(otherKeys, mergeDeepProperties)
  1343.       return config
  1344.       }
  1345.       /***/ },
  1346.     /* 23 */
  1347.     /***/ function(module, exports) {
  1348.       'use strict'
  1349.       /**
  1350.      * A `Cancel` is an object that is thrown when an operation is canceled.
  1351.      *
  1352.      * @class
  1353.      * @param {string=} message The message.
  1354.      */
  1355.       function Cancel(message) {
  1356.       this.message = message
  1357.       }
  1358.       Cancel.prototype.toString = function toString() {
  1359.       return 'Cancel' + (this.message ? ': ' + this.message : '')
  1360.       }
  1361.       Cancel.prototype.__CANCEL__ = true
  1362.       module.exports = Cancel
  1363.       /***/ },
  1364.     /* 24 */
  1365.     /***/ function(module, exports, __webpack_require__) {
  1366.       'use strict'
  1367.       var Cancel = __webpack_require__(23)
  1368.       /**
  1369.      * A `CancelToken` is an object that can be used to request cancellation of an operation.
  1370.      *
  1371.      * @class
  1372.      * @param {Function} executor The executor function.
  1373.      */
  1374.       function CancelToken(executor) {
  1375.       if (typeof executor !== 'function') {
  1376.         throw new TypeError('executor must be a function.')
  1377.       }
  1378.       var resolvePromise
  1379.       this.promise = new Promise(function promiseExecutor(resolve) {
  1380.         resolvePromise = resolve
  1381.       })
  1382.       var token = this
  1383.       executor(function cancel(message) {
  1384.         if (token.reason) {
  1385.           // Cancellation has already been requested
  1386.           return
  1387.         }
  1388.         token.reason = new Cancel(message)
  1389.         resolvePromise(token.reason)
  1390.       })
  1391.       }
  1392.       /**
  1393.      * Throws a `Cancel` if cancellation has been requested.
  1394.      */
  1395.       CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  1396.       if (this.reason) {
  1397.         throw this.reason
  1398.       }
  1399.       }
  1400.       /**
  1401.      * Returns an object that contains a new `CancelToken` and a function that, when called,
  1402.      * cancels the `CancelToken`.
  1403.      */
  1404.       CancelToken.source = function source() {
  1405.       var cancel
  1406.       var token = new CancelToken(function executor(c) {
  1407.         cancel = c
  1408.       })
  1409.       return {
  1410.         token: token,
  1411.         cancel: cancel
  1412.       }
  1413.       }
  1414.       module.exports = CancelToken
  1415.       /***/ },
  1416.     /* 25 */
  1417.     /***/ function(module, exports) {
  1418.       'use strict'
  1419.       /**
  1420.      * Syntactic sugar for invoking a function and expanding an array for arguments.
  1421.      *
  1422.      * Common use case would be to use `Function.prototype.apply`.
  1423.      *
  1424.      *  ```js
  1425.      *  function f(x, y, z) {}
  1426.      *  var args = [1, 2, 3];
  1427.      *  f.apply(null, args);
  1428.      *  ```
  1429.      *
  1430.      * With `spread` this example can be re-written.
  1431.      *
  1432.      *  ```js
  1433.      *  spread(function(x, y, z) {})([1, 2, 3]);
  1434.      *  ```
  1435.      *
  1436.      * @param {Function} callback
  1437.      * @returns {Function}
  1438.      */
  1439.       module.exports = function spread(callback) {
  1440.       return function wrap(arr) {
  1441.         return callback.apply(null, arr)
  1442.       }
  1443.       }
  1444.       /***/ }
  1445.     /** ****/ ])
  1446. })
  1447. // # sourceMappingURL=axios.map

然后在src\main.js加入以下代码:import axios from 'axios'

要使用时,只需要在相应界面的

script中加入以下代码即可

import axios from 'axios'

mock数据提取具体代码:

  1. mounted() {
  2.     this.fetchdata()
  3.   },
  4.   // components:{pagination},
  5.   methods: {
  6.     // 获取后端数据
  7.     async fetchdata() {
  8.       axios
  9.         .get( 
  10.           'https://www.fastmock.site/mock/fc95a74a01e7f9841b9b6a5051f5da07/package/classinfo'
  11.         )//此地址为mock平台接口,mock平台使用可以参考 http://t.csdn.cn/tlMkt
  12.         .then((response) => {
  13.           console.log(response)
  14.           this.tableData = response.data.data
  15.           this.total = response.data.data.length
  16.         })
  17.     },

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/707312
推荐阅读
相关标签
  

闽ICP备14008679号