Files
documenter-mono/resources/js/Components/Input/FileUpload.vue
2025-10-31 16:48:05 +09:00

36 lines
639 B
Vue

<script setup>
import Input from "./Input.vue"
import {ref} from "vue";
const props = defineProps({
accept: {
type: String,
default: ''
}
})
const fileRef = ref(null)
const file = defineModel('file')
const fileList = defineModel('fileList')
const onFileChanged = (e) => {
const target = e.target
if (target && target.files) {
fileList.value = target.files
file.value = target.files[0]
}
}
</script>
<template>
<Input ref="fileRef"
type="file"
@change="(e) => onFileChanged(e)"
:accept="accept"
/>
</template>
<style scoped>
</style>