as shown in the figure
//axios
import axios from "axios"
axios.defaults.withCredentials = true; //
const service=axios.create({
baseURL:`${base}${itempath}`,
timeout:5000
})
service.interceptors.request.use(
config=>{
if(store.getters.token){
config.headers={
"token":getToken(),
"Accept":"application/json",
"Content-Type":"application/json;charset=UTF-8"
}
}
return config;
},
error=>{
console.log(error);
Promise.reject(error);
}
)
the backend is also cross-domain, which can be requested normally before.