/* * @Author: ch * @Date: 2022-05-04 17:11:07 * @LastEditors: ch * @LastEditTime: 2022-05-04 21:50:14 * @Description: file content */ let axiosTk = null; export default function ({$axios, store}, inject) { const $axiosTk = $axios.create(); $axiosTk.onRequest( config =>{ if(!store.state.token){ return Promise.reject({message : '要先登录才能操作哦~'}); } config.headers.Authorization = store.state.token; return config; }); inject('$axiosTk', $axiosTk); axiosTk = $axiosTk; } export {axiosTk}