diff --git a/templates/js-template-default/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets b/templates/js-template-default/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets index 9bb85561ad..90a8c84838 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets +++ b/templates/js-template-default/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets @@ -39,6 +39,9 @@ export struct EditBoxDialog { .defaultFocus(true) .backgroundColor('#ffffff') .layoutWeight(1) + .onBlur(() => { + this.controller?.close(); + }) .onChange((value) => { if (this.onTextChange) { this.onTextChange(value); diff --git a/templates/js-template-link/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets b/templates/js-template-link/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets index 9bb85561ad..90a8c84838 100644 --- a/templates/js-template-link/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets +++ b/templates/js-template-link/frameworks/runtime-src/proj.harmonyos-next/entry/src/main/ets/components/EditBoxDialog.ets @@ -39,6 +39,9 @@ export struct EditBoxDialog { .defaultFocus(true) .backgroundColor('#ffffff') .layoutWeight(1) + .onBlur(() => { + this.controller?.close(); + }) .onChange((value) => { if (this.onTextChange) { this.onTextChange(value);