-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprogress.js
53 lines (50 loc) · 1.09 KB
/
progress.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import NProgress from 'nprogress';
import Vue from 'vue';
const pageTemp = {
template: `
<div id="progressbar" class="progressing">
<div class="bar" role="bar">
<div class="peg"></div>
</div>
<div class="particlesdiv">
<div class="sk-cube-grid">
<div class="sk-cube sk-cube1"></div>
<div class="sk-cube sk-cube2"></div>
<div class="sk-cube sk-cube3"></div>
<div class="sk-cube sk-cube4"></div>
<div class="sk-cube sk-cube5"></div>
<div class="sk-cube sk-cube6"></div>
<div class="sk-cube sk-cube7"></div>
<div class="sk-cube sk-cube8"></div>
<div class="sk-cube sk-cube9"></div>
</div>
</div>
</div>
`
}
const loadTemp = {
template: `
<div id="progressbar">
<div class="bar" role="bar">
<div class="peg"></div>
</div>
</div>
`
}
Vue.use({
install: function (Vue, options) {
Vue.prototype.$load = {
start(state) {
if (!state || state === "load") {
NProgress.configure(loadTemp)
} else if (state === "page") {
NProgress.configure(pageTemp)
}
NProgress.start()
},
done() {
NProgress.done()
}
}
}
})