本文整理汇总了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();
}