vue-element-admin的api的js文件 get, post, put, delelt傳參


 
         
// 項目中用到的所有分類樹的接口
import request from '@/utils/request'

// 這個是get拼接的傳參 第一次遇到這種風格.......
export function getStandardTree(data, type) {
  return request({
    url: '/classification/tree/' + data + "/" + type,
    method: 'get',
  })
}

// get請求 單個參數
export function getStandardTree2(data) {
  return request({
    url: '/classification/tree' + data,
    method: 'get'
  })
}

// 以下都是JSON格式傳參的接口
// get請求 多個參數
export function getStandardTree1(data) {
  return request({
    url: '/classification/tree',
    method: 'get',
    params: data 
  })
}

// post請求 
export function getStandardTree3(data) {
  return request({
    url: '/classification/tree',
    method: 'post',
    data 
  })
}
 

 平常我們一直說的axios傳參方式是: get傳參用params, post 用data; put和delelt與post傳參f相同

總結是上面幾類

axios在node包里也已經配置好了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM