<script lang="ts" setup>
import { ref } from 'vue'
import Upload from '../Upload.vue'

const props = defineProps<{
  value: string
  label: string
}>()

const emit = defineEmits<{
  (e: 'update:value', value: string): void
}>()

const url = ref<string>(props.value)

function onChange(value: string) {
  emit('update:value', value)
}
</script>

<template>
  <div class="wrapper">
    <n-collapse :default-expanded-names="['1']" arrow-placement="right">
      <n-collapse-item :title="label" name="1">
        <Upload v-model:value="url" @update:value="onChange" />
      </n-collapse-item>
    </n-collapse>
  </div>
</template>

<style lang="less" scoped>
.wrapper {
  padding: 10px;
}
</style>
