本文整理匯總了TypeScript中nprogress.start函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript start函數的具體用法?TypeScript start怎麽用?TypeScript start使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了start函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: next
router.beforeEach((to, from, next) => {
NProgress.start();
// if (store.getters.token) {
// if (to.path === '/login') { // 自動登陸
// next({ path: '/' })
// NProgress.done() // if current page is dashboard will not trigger afterEach hook, so manually handle it
// } else {
// if (store.getters.roles.length === 0) {
// store.dispatch('GetInfo').then(res => { // 拉取用戶信息
// next()
// }).catch((err) => {
// store.dispatch('FedLogOut').then(() => {
// Message.error(err || 'Verification failed, please login again')
// next({ name: 'login' })
// })
// })
// } else {
next();
// }
// }
// } else {
// if (whiteList.indexOf(to.path) !== -1) {
// next()
// } else {
// next('/login')
// NProgress.done()
// }
// }
});
示例2: next
router.beforeEach((to: Route, from: Route, next: any) => {
NProgress.start();
if (getToken()) {
if (to.path === '/login') {
next({ path: '/' });
NProgress.done(); // If current page is dashboard will not trigger afterEach hook, so manually handle it
} else {
next()
// if (UserModule.roles.length === 0) {
// UserModule.GetInfo().then(() => {
// next();
// }).catch((err) => {
// UserModule.FedLogOut().then(() => {
// Message.error(err || 'Verification failed, please login again');
// next({ path: '/' });
// });
// });
// } else {
// next();
// }
}
} else {
if (whiteList.indexOf(to.path) !== -1) {
next();
} else {
next(`/login?redirect=${to.path}`); // 否則全部重定向到登錄頁
NProgress.done();
}
}
// next();
});
示例3: createAction
export const getUsers = createAction('GET_USERS', async () => {
try {
NProgress.start();
return await client.users.getUsers();
} finally {
NProgress.done();
}
});
示例4: getToken
service.interceptors.request.use(config => {
// Do something before request is sent
NProgress.start()
config.headers['X-Page-Url'] = location.href
config.headers['Authorization'] = getToken()
getToken
return config
}, error => {
示例5: createAction
export const fetch = createAction('FETCH', async (url: string) => {
try {
NProgress.start();
const response = await request.get(url);
return response.text;
} finally {
NProgress.done();
}
}, (url: string) => ({ url }));
示例6: next
router.beforeEach((to, _from, next) => {
if (to.path === '/login') {
localStorage.removeItem('userInfo');
}
let userInfo = localStorage.getItem('userInfo');
if (false && !userInfo && to.path !== '/login') {
// next({ path: '/login' });
} else {
NProgress.start();
next();
}
});
示例7: start
start() {
if ("undefined" != typeof NProgress){
NProgress.start();
}
}
示例8:
Router.onRouteChangeStart = () => progress.start();
示例9:
start: () => {
root.classList.add('progress');
NProgress.start();
},
示例10: start
start() {
nprogress.start();
nprogress.inc();
}