当前位置:网站首页>Nprogress plug-in progress bar
Nprogress plug-in progress bar
2022-07-05 20:29:00 【Cheng_ eighty-eight】
One 、 Installation dependency
npm install nprogress -S
Two 、 Introduce progress bar NProgress And corresponding styles (request.js In file )
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
3、 ... and 、 Use
// Request interceptor
instance.interceptors.request.use(
config => {
// stay request In the interceptor , Show the progress bar NProgress.start()
NProgress.start()
if (sessionStorage.getItem('token')) {
config.headers.Authorization = sessionStorage.getItem('token')
}
return config
},
err => {
return Promise.reject(err)
}
)
// Response interceptors
instance.interceptors.response.use(
res => {
// stay response In the interceptor , Hide progress bar NProgress.done()
NProgress.done()
if (res.status === 200) {
return Promise.resolve(res.data)
} else {
return Promise.reject(res)
}
},
err => {
return Promise.reject(err)
}
)
边栏推荐
猜你喜欢
![Scala basics [HelloWorld code parsing, variables and identifiers]](/img/75/1d89581b9b8299ffb55d95514e6df4.png)
Scala basics [HelloWorld code parsing, variables and identifiers]

解决php无法将string转换为json的办法

Unity editor extended UI control

CVPR 2022 | 常见3D损坏和数据增强

小程序全局配置
![[quick start to digital IC Verification] 8. Typical circuits in digital ICs and their corresponding Verilog description methods](/img/3a/7eaff0bf819c129b4f866388e57b87.png)
[quick start to digital IC Verification] 8. Typical circuits in digital ICs and their corresponding Verilog description methods
![[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design](/img/32/a156293f145417eeae8d93c539ca55.png)
[quick start of Digital IC Verification] 9. Finite state machine (FSM) necessary for Verilog RTL design

PyTorch 1.12发布,正式支持苹果M1芯片GPU加速,修复众多Bug

【数字IC验证快速入门】1、浅谈数字IC验证,了解专栏内容,明确学习目标

Leetcode skimming: binary tree 16 (path sum)
随机推荐
Leetcode skimming: binary tree 12 (all paths of binary tree)
什么是pyc文件
E. Singhal and numbers (prime factor decomposition)
鸿蒙系统控制LED的实现方法之经典
Informatics Olympiad 1340: [example 3-5] extended binary tree
mongodb基操的练习
欢迎来战,赢取丰厚奖金:Code Golf 代码高尔夫挑战赛正式启动
B站UP搭建世界首个纯红石神经网络、基于深度学习动作识别的色情检测、陈天奇《机器学编译MLC》课程进展、AI前沿论文 | ShowMeAI资讯日报 #07.05
Classic implementation method of Hongmeng system controlling LED
Guidelines for application of Shenzhen green and low carbon industry support plan in 2023
Usaco3.4 "broken Gong rock" band raucous rockers - DP
Hongmeng OS' fourth learning
Hong Kong stocks will welcome the "best ten yuan store". Can famous creative products break through through the IPO?
Notes on key vocabulary in the English original of the biography of jobs (12) [chapter ten & eleven]
2.8 basic knowledge of project management process
Leetcode (695) - the largest area of an island
JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)
Wechat applet regular expression extraction link
Enter the parallel world
港股将迎“最牛十元店“,名创优品能借IPO突围?