当前位置:网站首页>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)
}
)
边栏推荐
- nprogress插件 进度条
- Rainbond 5.7.1 支持对接多家公有云和集群异常报警
- C language OJ gets PE, OJ of ACM introduction~
- 信息学奥赛一本通 1339:【例3-4】求后序遍历 | 洛谷 P1827 [USACO3.4] 美国血统 American Heritage
- 2.8、项目管理过程基础知识
- Unity编辑器扩展 UI控件篇
- 银河证券在网上开户安全吗?
- About the priority of Bram IP reset
- 【数字IC验证快速入门】6、Questasim 快速上手使用(以全加器设计与验证为例)
- Reinforcement learning - learning notes 4 | actor critical
猜你喜欢
计算lnx的一种方式
14、Transformer--VIT TNT BETR
Classic implementation method of Hongmeng system controlling LED
Mysql频繁操作出现锁表问题
Guidelines for application of Shenzhen green and low carbon industry support plan in 2023
欢迎来战,赢取丰厚奖金:Code Golf 代码高尔夫挑战赛正式启动
JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)
全国爱眼教育大会,2022第四届北京国际青少年眼健康产业展会
Leetcode brush question: binary tree 14 (sum of left leaves)
Leetcode skimming: binary tree 16 (path sum)
随机推荐
CTF逆向基础
2022北京眼睛健康用品展,护眼产品展,中国眼博会11月举办
.Net分布式事務及落地解决方案
Leetcode(695)——岛屿的最大面积
[quick start of Digital IC Verification] 6. Quick start of questasim (taking the design and verification of full adder as an example)
Codeforces Round #804 (Div. 2) - A, B, C
本季度干货导航 | 2022年Q2
CTF reverse Foundation
【数字IC验证快速入门】2、通过一个SoC项目实例,了解SoC的架构,初探数字系统设计流程
走入并行的世界
【刷题记录】1. 两数之和
[record of question brushing] 1 Sum of two numbers
常用的视图容器类组件
Informatics Olympiad 1337: [example 3-2] word search tree | Luogu p5755 [noi2000] word search tree
[C language] merge sort
Some problems encountered in cocos2d-x project summary
Scala基础【HelloWorld代码解析,变量和标识符】
- Oui. Net Distributed Transaction and Landing Solution
Y57. Chapter III kubernetes from entry to proficiency -- business image version upgrade and rollback (30)
JS implementation prohibits web page zooming (ctrl+ mouse, +, - zooming effective pro test)