Skip to content
This repository was archived by the owner on Apr 17, 2022. It is now read-only.

Commit 2e2424c

Browse files
committed
feat: Add required prop
1 parent 543596b commit 2e2424c

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ interface Vue3DatePicker {
5353
weekStart?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | 0 | 1 | 2 | 3 | 4 | 5 | 6;
5454
disabled?: boolean;
5555
readonly?: boolean;
56+
required?: boolean;
5657
format?:
5758
| string
5859
| ((

src/Vue3DatePicker/Vue3DatePicker.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
autoApply,
2020
uid,
2121
openMenuOnFocus,
22+
required,
2223
}"
2324
v-model:input-value="inputValue"
2425
@clear="clearValue"
@@ -193,6 +194,7 @@
193194
weekStart: { type: [String, Number] as PropType<WeekStartNum | WeekStartStr>, default: 1 },
194195
disabled: { type: Boolean as PropType<boolean>, default: false },
195196
readonly: { type: Boolean as PropType<boolean>, default: false },
197+
required: { type: Boolean as PropType<boolean>, default: false },
196198
monthNameFormat: { type: String as PropType<'long' | 'short'>, default: 'short' },
197199
weekNumName: { type: String as PropType<string>, default: 'W' },
198200
format: {

src/Vue3DatePicker/components/DatepickerInput.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
:class="inputClass"
2424
:placeholder="placeholder"
2525
:disabled="disabled"
26-
:readonly="!textInput"
26+
:readonly="readonly"
27+
:required="required"
2728
:value="inputValue"
2829
@input="handleInput"
2930
@keydown.enter="handleEnter"
@@ -86,6 +87,7 @@
8687
pattern: { type: String as PropType<string>, default: '' },
8788
uid: { type: String as PropType<string>, default: null },
8889
openMenuOnFocus: { type: Boolean as PropType<boolean>, default: true },
90+
required: { type: Boolean as PropType<boolean>, default: false },
8991
});
9092
const parsedDate = ref();
9193
const inputRef = ref(null);

0 commit comments

Comments
 (0)