Skip to content

Commit e3ef513

Browse files
fix(VFileInput): closable slotted chips (#20250)
fixes #18638 Co-authored-by: John Leider <[email protected]>
1 parent 98003f2 commit e3ef513

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/vuetify/src/components/VFileInput/VFileInput.sass

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
position: absolute
3232
top: 0
3333
width: 100%
34-
z-index: 1
3534

3635
.v-input__details
3736
padding-inline: $file-input-details-padding-inline

packages/vuetify/src/components/VFileInput/VFileInput.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ export const VFileInput = genericComponent<VFileInputSlots>()({
155155
callEvent(props['onClick:clear'], e)
156156
})
157157
}
158+
function onDragover (e: DragEvent) {
159+
e.preventDefault()
160+
}
161+
function onDrop (e: DragEvent) {
162+
e.preventDefault()
163+
164+
if (!e.dataTransfer) return
165+
166+
model.value = [...e.dataTransfer.files ?? []]
167+
}
158168

159169
watch(model, newValue => {
160170
const hasModelReset = !Array.isArray(newValue) || !newValue.length
@@ -215,6 +225,8 @@ export const VFileInput = genericComponent<VFileInputSlots>()({
215225
disabled={ isDisabled.value }
216226
focused={ isFocused.value }
217227
error={ isValid.value === false }
228+
onDragover={ onDragover }
229+
onDrop={ onDrop }
218230
>
219231
{{
220232
...slots,

0 commit comments

Comments
 (0)