From 6a2bd4c60046e54130f90103cd8972333b52c763 Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Wed, 27 Mar 2024 11:21:23 +0100 Subject: [PATCH 1/3] fix(Input): change event for file input --- src/runtime/components/forms/Input.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/components/forms/Input.vue b/src/runtime/components/forms/Input.vue index 150a8e0d7f..a03fbc7791 100644 --- a/src/runtime/components/forms/Input.vue +++ b/src/runtime/components/forms/Input.vue @@ -205,7 +205,7 @@ export default defineComponent({ } const onChange = (event: Event) => { - const value = (event.target as HTMLInputElement).value + const value = props.type === 'file' ? (event.target as HTMLInputElement).files : (event.target as HTMLInputElement).value emit('change', value) if (modelModifiers.value.lazy) { From bc0a6883f54eec26ff645fefe471b3c9aa0a9455 Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Wed, 27 Mar 2024 11:21:45 +0100 Subject: [PATCH 2/3] fix(SelectMenu): change emit --- src/runtime/components/forms/SelectMenu.vue | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/runtime/components/forms/SelectMenu.vue b/src/runtime/components/forms/SelectMenu.vue index 212bddba84..38bd6fad48 100644 --- a/src/runtime/components/forms/SelectMenu.vue +++ b/src/runtime/components/forms/SelectMenu.vue @@ -63,7 +63,7 @@ autofocus autocomplete="off" :class="uiMenu.input" - @change="onChange" + @change="onQueryChange" /> Date: Wed, 27 Mar 2024 11:41:58 +0100 Subject: [PATCH 3/3] fix(Input): types --- src/runtime/components/forms/Input.vue | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/runtime/components/forms/Input.vue b/src/runtime/components/forms/Input.vue index a03fbc7791..55f4f3d60d 100644 --- a/src/runtime/components/forms/Input.vue +++ b/src/runtime/components/forms/Input.vue @@ -205,16 +205,19 @@ export default defineComponent({ } const onChange = (event: Event) => { - const value = props.type === 'file' ? (event.target as HTMLInputElement).files : (event.target as HTMLInputElement).value - emit('change', value) - - if (modelModifiers.value.lazy) { - updateInput(value) - } - - // Update trimmed input so that it has same behavior as native input https://github.com/vuejs/core/blob/5ea8a8a4fab4e19a71e123e4d27d051f5e927172/packages/runtime-dom/src/directives/vModel.ts#L63 - if (modelModifiers.value.trim) { - (event.target as HTMLInputElement).value = value.trim() + if (props.type === 'file') { + const value = (event.target as HTMLInputElement).files + emit('change', value) + } else { + const value = (event.target as HTMLInputElement).value + emit('change', value) + if (modelModifiers.value.lazy) { + updateInput(value) + } + // Update trimmed input so that it has same behavior as native input https://github.com/vuejs/core/blob/5ea8a8a4fab4e19a71e123e4d27d051f5e927172/packages/runtime-dom/src/directives/vModel.ts#L63 + if (modelModifiers.value.trim) { + (event.target as HTMLInputElement).value = value.trim() + } } }