File tree Expand file tree Collapse file tree 5 files changed +14
-0
lines changed
Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 3737 "request-promise" : " ^4.2.0" ,
3838 "roboto-fontface" : " ^0.7.0" ,
3939 "vue" : " ^2.2.5" ,
40+ "vue-progressbar" : " ^0.7.1" ,
4041 "vue-resource" : " ^1.2.1" ,
4142 "vue-router" : " ^2.1.1" ,
4243 "vuex" : " ^2.2.1"
Original file line number Diff line number Diff line change 11<template lang="pug">
22 div#app
3+ vue-progress-bar
34 app-header
45 router-view
56 app-footer
Original file line number Diff line number Diff line change @@ -92,8 +92,11 @@ export default {
9292 }),
9393 async created () {
9494 try {
95+ this .$Progress .start ();
9596 await this .$store .dispatch (' fetchList' );
97+ this .$Progress .finish ();
9698 } catch (e) {
99+ this .$Progress .fail ();
97100 this .message = ' 加载出错,你可以尝试登陆后重试' ;
98101 this .snackbar = true ;
99102 }
Original file line number Diff line number Diff line change @@ -111,11 +111,14 @@ export default {
111111 },
112112 async created () {
113113 try {
114+ this .$Progress .start ();
114115 await Promise .all ([
115116 this .$store .dispatch (' fetchPost' , this .id ),
116117 this .$store .dispatch (' fetchComments' , this .id )
117118 ]);
119+ this .$Progress .finish ();
118120 } catch (e) {
121+ this .$Progress .fail ();
119122 this .message = ' 加载出错,你可以尝试登陆后重试' ;
120123 this .snackbar = true ;
121124 }
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import Vue from 'vue'
33import Vuex from 'vuex'
44import VueRouter from 'vue-router'
55import VueResource from 'vue-resource'
6+ import VueProgressBar from 'vue-progressbar'
67
78import MuseUI from 'muse-ui'
89
@@ -19,6 +20,11 @@ Vue.use(VueResource);
1920Vue . use ( VueRouter ) ;
2021Vue . use ( MuseUI ) ;
2122Vue . use ( Vuex ) ;
23+ Vue . use ( VueProgressBar , {
24+ color : '#42a5f5' ,
25+ failedColor : '#f44336' ,
26+ thickness : '2px'
27+ } ) ;
2228
2329Vue . http . options . root = '/api' ;
2430const token = window . localStorage && window . localStorage . getItem ( 'GITHUB_TOKEN' ) ;
You can’t perform that action at this time.
0 commit comments