<!--
  @description 文件上传组件，封装文件选择、上传进度与结果回调
  @author D吕贺034244311
  @date 20260616
-->
<template>
  <div>
    <file-upload-local v-model="fileUrl" :accept="accept" :tips="tips" :list-type="listType" />
  </div>
</template>

<script>

import FileUploadLocal from './local.vue'

export default {
  name: 'FileUpload',
  components: { FileUploadLocal },
  props: {
    modelValue: String,
    accept: {
      type: String,
      default: '*'
    },
    tips: String,
    listType: {
      type: String,
      default: 'picture'
    }
  },
  data() {
    return {
      fileUrl: ''
    }
  },

  watch: {
    // 检测查询变化
    modelValue: {
      handler() {
        this.fillValue()
      }
    },

    // 检测查询变化
    fileUrl: {
      handler() {
        this.$emit('update:modelValue', this.fileUrl)
      }
    }
  },
  mounted() {

  },

  created() {
    this.fillValue()
  },

  methods: {

    fillValue() {
      this.fileUrl = this.modelValue
    }

  }
}
</script>
