file props,emit 추가

This commit is contained in:
ckx6954 2024-12-17 10:32:12 +09:00
parent 91ff743872
commit aec813bb92
2 changed files with 23 additions and 3 deletions

View File

@ -1,13 +1,32 @@
<template>
<div class="mb-4 row">
<label for="html5-email-input" class="col-md-2 col-form-label"> 첨부파일 </label>
<label :for="name" class="col-md-2 col-form-label">{{ title }} </label>
<div class="col-md-10">
<input class="form-control" type="file" id="formFileMultiple" multiple />
<input class="form-control" type="file" :id="name" @change="changeHandler" multiple />
</div>
</div>
</template>
<script setup>
const prop = defineProps({
title: {
type: String,
default: '라벨',
required: true,
},
name: {
type: String,
default: 'nameplz',
required: true,
},
});
const emits = defineEmits(['update:data']);
const changeHandler = (event) => {
const files = Array.from(event.target.files);
emits('update:data', files);
};
</script>
<style>

View File

@ -15,7 +15,7 @@
<FormInput title="비밀번호" name="pw" type="password" :is-essential="true" @update:data="password = $event" />
<FormFile />
<FormFile title="첨부파일" name="files" @update:data="attachFiles = $event" />
<div class="mb-4">
<label for="html5-tel-input" class="col-md-2 col-form-label">
@ -50,6 +50,7 @@ const title = ref('');
const password = ref('');
const category = ref('');
const content = ref('');
const attachFiles = ref(null);
</script>
<style>