nprogress 窗口进度条
作者:互联网
1.安装后引入包
import NProgress from 'nprogress'
2.引入样式
import 'nprogress/nprogress.css'
3.`请求拦截器和相应拦截器中添加加载进度条`
axios.interceptors.request.use((config)=>{
NProgress.start();
config.headers.Authorization = window.sessionStorage.getItem('token');
return config;
})
axios.interceptors.response.use((config)=>{
NProgress.done()
return config;
})
标签:use,拦截器,窗口,进度条,interceptors,nprogress,config,NProgress 来源: https://www.cnblogs.com/Cannery-Row/p/16324587.html