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.引用示例:

  

 

转载于:https://www.cnblogs.com/HQ0422/p/11462854.html

你可能感兴趣的:(javascript,前端,测试)