本文整理汇总了TypeScript中ng-zorro-antd.NzMessageService类的典型用法代码示例。如果您正苦于以下问题:TypeScript NzMessageService类的具体用法?TypeScript NzMessageService怎么用?TypeScript NzMessageService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NzMessageService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: handleChange
// tslint:disable-next-line:typedef
handleChange({ file, fileList }): void {
const status = file.status;
if (status !== 'uploading') {
console.log(file, fileList);
}
if (status === 'done') {
this.msg.success(`${file.name} file uploaded successfully.`);
} else if (status === 'error') {
this.msg.error(`${file.name} file upload failed.`);
}
}
示例2: setTimeout
this.identity.logout().then(res => {
if (res.Type == AjaxResultType.Success) {
this.msgSrv.success("用户退出成功");
let url = this.router.url;
if (url.startsWith("/admin/")) {
url = "/home";
}
setTimeout(() => {
this.router.navigateByUrl(url);
}, 100);
return;
}
this.msgSrv.error(`用户登出失败:${res.Content}`);
});
示例3: handleError
private handleError(errResp: HttpErrorResponse | any) {
let errMsg: any;
if (errResp instanceof HttpErrorResponse) {
switch (errResp.status) {
case 401:
// handle Unauthorized error and redirect to login page
errMsg = '401 Unauthorized';
console.log(this.router.url);
if (this.router.url !== '/login') {
this.router.navigate(['/login']);
}
break;
case 403:
errMsg = '403 Forbidden';
console.log();
if (errResp.error['code'] === 1) {
this.router.navigate(['/login']);
} else {
this.message.warning('没有权限');
}
break;
default:
// this.message.error('请求错误');
break;
}
} else {
errMsg = 'Request Error';
}
return throwError(errResp.error as HttpError);
}
示例4: Observable
return new Observable((observer) => {
if (this.userSrv.isLogin) {
observer.next(true);
observer.complete();
return;
}
this.msg.error('请先登录');
observer.next(false);
observer.complete();
});
示例5: Observable
return new Observable((observer) => {
if (this.userSrv.hasRole('admin')) {
observer.next(true);
observer.complete();
return;
}
this.msg.error('授权不足');
observer.next(false);
observer.complete();
});
示例6: successHandle
this.tenantApi.listCurrent().subscribe(tenants => {
console.log(tenants.data);
if (tenants.data.length <= 0) {
this.message.error('未绑定租户');
return;
}
if (tenants.data.length <= 1) {
successHandle(tenants.data[0]);
} else {
const modal = this.modal.create({
nzTitle: '选择公司',
nzWidth: '521px',
nzContent: LoginTenantSelectComponent,
nzComponentParams: {
tenants: tenants.data
},
nzFooter: null
});
modal.afterClose.subscribe((t: Tenant) => {
successHandle(t);
});
}
});
示例7:
.subscribe(result => this.msg.info(`subscribe sub status: ${JSON.stringify(result)}`));
示例8:
onOk: () => {
localStorage.clear();
this.messageServ.success('Clear Finished!');
}
示例9: copy
copy(value).then(() => this.msg.success(this.i18n.fanyi('app.demo.copied')));
示例10:
_clear() {
localStorage.clear();
this.messageServ.success('清空完成!');
}