24 lines
597 B
JavaScript
24 lines
597 B
JavaScript
const install = (Vue, vm) => {
|
|
// 此为自定义配置参数,具体参数见上方说明
|
|
Vue.prototype.$u.http.setConfig({
|
|
baseUrl: 'https://dmmall.sdbairui.com/storeapi',
|
|
loadingText: '努力加载中~',
|
|
loadingTime: 800,
|
|
originalData: true,
|
|
|
|
});
|
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
|
const token = uni.getStorageSync('token');
|
|
config.header.Authorization = 'Bearer' + " " + token;
|
|
return config;
|
|
}
|
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
|
// todo 判断状态码
|
|
return res.data;
|
|
}
|
|
}
|
|
|
|
export default {
|
|
install
|
|
}
|