修复空值,显示异常bug #17

Merged
xiaohai2271 merged 1 commits from dev into master 2020-06-30 17:44:09 +08:00
Showing only changes of commit b60688cfd7 - Show all commits

View File

@@ -70,6 +70,9 @@ export class AdminLinkComponent implements OnInit {
linkReq.name = this.formGroup.value.name; linkReq.name = this.formGroup.value.name;
linkReq.url = this.formGroup.value.url; linkReq.url = this.formGroup.value.url;
linkReq.open = this.formGroup.value.open; linkReq.open = this.formGroup.value.open;
// 暂时设置未空
linkReq.desc = '';
linkReq.iconPath = '';
const oper = this.formGroup.value.oper; const oper = this.formGroup.value.oper;
let observable: Observable<Response<Link>>; let observable: Observable<Response<Link>>;
if (oper === 'edit') { if (oper === 'edit') {
@@ -80,7 +83,7 @@ export class AdminLinkComponent implements OnInit {
} }
observable.subscribe({ observable.subscribe({
next: data => this.messageService.success('操作成功'), next: data => this.messageService.success('操作成功'),
error: err => this.messageService.success('操作失败,', err.msg), error: err => this.messageService.error('操作失败,' + err.msg),
complete: () => this.getLinks() complete: () => this.getLinks()
}) })
} }
@@ -88,6 +91,7 @@ export class AdminLinkComponent implements OnInit {
addLink() { addLink() {
this.modalVisible = true; this.modalVisible = true;
this.modalTitle = '新增友链信息'; this.modalTitle = '新增友链信息';
this.formGroup.reset();
this.formGroup.controls.oper.setValue('add') this.formGroup.controls.oper.setValue('add')
} }
} }