zoukankan      html  css  js  c++  java
  • vue整理

    • 安装
      •   vue ui
    • axios
      •   
         1 import axios from 'axios'
         2 
         3 // let curWwwPath = window.document.location.href
         4 // let pathname = window.document.location.pathname
         5 // let pos = curWwwPath.indexOf(pathname)
         6 // let localhostPath = curWwwPath.substring(0, pos)
         7 // let root = localhostPath + pathname
         8 
         9 const root = 'http://localhost:8097/'
        10 
        11 function _sendRequest (url, method, data, callback, responsetype) {
        12   axios({
        13     method: method,
        14     url: url,
        15     data: method === 'POST' || method === 'post' || method === 'PUT' || method === 'put' ? data : null,
        16     params: method === 'GET' || method === 'get' || method === 'DELETE' || method === 'delete' ? data : null,
        17     baseURL: root19   }).then(function (response) {
        20     console.log(response)
        21     callback(response.data)
        22   }).catch(function (error) {
        23     if (error.response) {
        24       console.log('Error' + error.response.data)
        25       console.log('Error' + error.response.status)
        26       console.log(error.response.headers)
        27     } else {
        28       console.log('Error', error.message)
        29     }
        30     console.log(error.config)
        31   })
        32 }
        33 
        34 export default {
        35   sendRequest: function (url, method, data, callback, responseType) {
        36     _sendRequest(url, method, data, callback, responseType)
        37   }
        38 }
  • 相关阅读:
    Flex实现页面多态state对象
    Flex精华摘要使用AS脚本
    JMeter最常用的三种类型的压力测试
    工作流简介
    Android模拟器使用模拟SD卡
    交大研究生,就一个字牛
    Google code上利用SVN托管代码
    主流浏览器内核概览
    Android开发之ADB使用
    Redis入门教程
  • 原文地址:https://www.cnblogs.com/rain318/p/9516110.html
Copyright © 2011-2022 走看看