From 5524b8a80bcf77ccfdb94f8eea44f0596b0e0e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Sat, 11 Jul 2020 00:36:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E5=8F=AF=E7=BC=96=E8=BE=91Ta?= =?UTF-8?q?g=E7=BB=84=E4=BB=B6-=E6=96=B0=E5=A2=9Eapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../editable-tag/editable-tag.component.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/app/view/admin/components/editable-tag/editable-tag.component.ts b/src/app/view/admin/components/editable-tag/editable-tag.component.ts index 851a289..4736ea7 100644 --- a/src/app/view/admin/components/editable-tag/editable-tag.component.ts +++ b/src/app/view/admin/components/editable-tag/editable-tag.component.ts @@ -15,13 +15,14 @@ import {NzModalRef, NzModalService} from 'ng-zorro-antd'; selector: 'editable-tag', template: ` {{text}} + (); @Output() modalCancel = new EventEmitter<{ value: string, originalValue: string, changed: boolean }>(); @@ -71,6 +75,9 @@ export class EditableTagComponent implements OnInit, OnChanges { if (this.showBorder == null) { this.showBorder = true; } + if (this.doubleClick == null) { + this.doubleClick = true; + } } ngOnChanges(changes: SimpleChanges): void { @@ -82,7 +89,7 @@ export class EditableTagComponent implements OnInit, OnChanges { showInput(doubleClick: boolean): void { this.inputValue = this.text; - if (doubleClick) { + if (this.doubleClick && doubleClick) { if (!this.doubleClickInfo.date) { this.doubleClickInfo.date = new Date().getTime(); return @@ -118,7 +125,7 @@ export class EditableTagComponent implements OnInit, OnChanges { this.text = this.inputValue; this.inputValue = ''; this.inputVisible = false; - if (this.showConfirmModal && value.changed) { + if (this.showConfirmModal && value.changed && this.text != null) { this.confirmModal = this.modal.confirm({ nzTitle: '数据变更', nzContent: '是否提交修改,点击确定提交修改,点击取消则恢复原数据', @@ -126,6 +133,9 @@ export class EditableTagComponent implements OnInit, OnChanges { nzOnCancel: () => this.modalCancel.emit(value) }); } + if (this.autoClear) { + this.text = null + } } }