前端专题

jeecg-boot通用get和post 请求使用说明

2019-05-31  本文已影响0人  挣扎在黑暗中的码畜

jeecg-boot在前端使用GET请求说明:

1.在页面中导入相关依赖:

import { deleteAction, getAction,downFile } from '@/api/manage'

导入发送get请求的依赖

2.请求方法:

getAction(this.url.list).then((res) => {console.log(res)})

请求方法

jeecg-boot在前端使用POST请求说明:

1.导入相关依赖:

导入发送post请求的依赖

2.请求方法:

httpAction(httpurl,formData,method).then((res)=>{console.log(res)})

请求方法

若请求时使用token,需要以下操作:

1.导入获取token的依赖:

获取token的依赖

2.页面属性中声明header字段:

页面中声明header字段

3. created ()方法中给this.header赋值:

上一篇 下一篇

猜你喜欢

热点阅读