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>
