jeecg请求时附加token

 

1.引入token依赖

  import { ACCESS_TOKEN } from "@/store/mutation-types"
  import Vue from 'vue'

2.在data的return中声明headers和token字段

  headers: { },

  token:{ }

3.在created(){ }中给this.header赋值

  created(){//加载事件

    const token=Vue.ls.get(ACCESS_TOKEN);

    this.headers={ authorization: 'authorization-text',"X-Access-Token":token }
  }

4.引用示例:

  <a-upload :action="请求地址" :data="token" :headers="headers"></a-upload>

文章来源:https://www.cnblogs.com/HQ0422/p/11462854.html

相关文章:

  • 2021-06-27
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案