@jswork/weapp-loading-interceptor
v1.0.7
Published
Loading interceptor for weapp.
Downloads
10
Readme
weapp-loading-interceptor
Loading interceptor for weapp.
installation
npm install @jswork/weapp-loading-interceptor
usage
import createInterceptors from '@jswork/weapp-loading-interceptor';
const weappLoadingIntercepotrs = createInterceptors({
onShow: (opts) => {
wx.showLoading({ title: '加载中', mask: true });
},
onHide: (opts) => {
wx.hideLoading();
},
});
const opts = {
adapter: 'UniappRequest',
slim: true,
interceptors: [...interceptorRequest, ...interceptorResponse, ...weappLoadingIntercepotrs],
transformResponse(inResponse) {
return inResponse.data;
},
};
nx.$api = httpSchema(schema, opts);
license
Code released under the MIT license.