Skip to content

Commit 092665b

Browse files
committed
feat: custom NProgress style
1 parent 426a2cc commit 092665b

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
@import url('../index.less');
2+
3+
/* Make clicks pass-through */
4+
#nprogress {
5+
pointer-events: none;
6+
}
7+
8+
#nprogress .bar {
9+
background: @primary-color;
10+
11+
position: fixed;
12+
z-index: 1031;
13+
top: 0;
14+
left: 0;
15+
16+
width: 100%;
17+
height: 2px;
18+
}
19+
20+
/* Fancy blur effect */
21+
#nprogress .peg {
22+
display: block;
23+
position: absolute;
24+
right: 0px;
25+
width: 100px;
26+
height: 100%;
27+
box-shadow: 0 0 10px @primary-color, 0 0 5px @primary-color;
28+
opacity: 1.0;
29+
30+
-webkit-transform: rotate(3deg) translate(0px, -4px);
31+
-ms-transform: rotate(3deg) translate(0px, -4px);
32+
transform: rotate(3deg) translate(0px, -4px);
33+
}
34+
35+
/* Remove these to get rid of the spinner */
36+
#nprogress .spinner {
37+
display: block;
38+
position: fixed;
39+
z-index: 1031;
40+
top: 15px;
41+
right: 15px;
42+
}
43+
44+
#nprogress .spinner-icon {
45+
width: 18px;
46+
height: 18px;
47+
box-sizing: border-box;
48+
49+
border: solid 2px transparent;
50+
border-top-color: @primary-color;
51+
border-left-color: @primary-color;
52+
border-radius: 50%;
53+
54+
-webkit-animation: nprogress-spinner 400ms linear infinite;
55+
animation: nprogress-spinner 400ms linear infinite;
56+
}
57+
58+
.nprogress-custom-parent {
59+
overflow: hidden;
60+
position: relative;
61+
}
62+
63+
.nprogress-custom-parent #nprogress .spinner,
64+
.nprogress-custom-parent #nprogress .bar {
65+
position: absolute;
66+
}
67+
68+
@-webkit-keyframes nprogress-spinner {
69+
0% { -webkit-transform: rotate(0deg); }
70+
100% { -webkit-transform: rotate(360deg); }
71+
}
72+
@keyframes nprogress-spinner {
73+
0% { transform: rotate(0deg); }
74+
100% { transform: rotate(360deg); }
75+
}
76+

β€Žsrc/permission.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import router from './router'
33
import store from './store'
44

55
import NProgress from 'nprogress' // progress bar
6-
import 'nprogress/nprogress.css' // progress bar style
6+
import '@/components/NProgress/nprogress.less' // progress bar custom style
77
import notification from 'ant-design-vue/es/notification'
88
import { setDocumentTitle, domTitle } from '@/utils/domUtil'
99
import { ACCESS_TOKEN } from '@/store/mutation-types'

0 commit comments

Comments
Β (0)