• 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 }
  • 相关阅读:
    Python iter() 函数
    Python file() 函数
    Python bin() 函数
    QTP自动化测试-打开运行报告
    mysql-笔记-数据类型
    mysql-笔记--增删改查
    mysql-笔记-命名、索引规范
    Navicat for MySQL 安装和破解
    mysql client--笔记-修改密码-登录-查看数据库-创建数据库
    安装mysql
  • 原文地址:https://www.cnblogs.com/rain318/p/9516110.html
Copyright © 2020-2023  润新知