From b9fcbe5149c2607499cb64ee786977ee3ae0356f Mon Sep 17 00:00:00 2001 From: Shamus Taylor Date: Thu, 18 Jan 2024 15:28:29 -0600 Subject: [PATCH 1/2] Add `required` prop Ability to set the `required` attribute on the HTML input element. This is useful when using modern browsers' builtin form validation. --- src/Multiselect.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Multiselect.vue b/src/Multiselect.vue index edef144e..87b474ed 100644 --- a/src/Multiselect.vue +++ b/src/Multiselect.vue @@ -57,6 +57,7 @@ :value="search" :disabled="disabled" :tabindex="tabindex" + :required="required" @input="updateSearch($event.target.value)" @focus.prevent="activate()" @blur.prevent="deactivate()" @@ -297,6 +298,10 @@ export default { tabindex: { type: Number, default: 0 + }, + required: { + type: Boolean, + default: undefined } }, computed: { From 1914abd3442305cdb5ccbb9c6fcab80b7e413305 Mon Sep 17 00:00:00 2001 From: Shamus Taylor Date: Thu, 18 Jan 2024 15:30:42 -0600 Subject: [PATCH 2/2] Required can default to false Was using undefined to completely omit the `required` attribute unless requested, but false works too. --- src/Multiselect.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Multiselect.vue b/src/Multiselect.vue index 87b474ed..b63039a6 100644 --- a/src/Multiselect.vue +++ b/src/Multiselect.vue @@ -301,7 +301,7 @@ export default { }, required: { type: Boolean, - default: undefined + default: false } }, computed: {