Newer
Older
Nanping_sponge_GCYPG / src / views / preassess / targetManage / upload.vue
@liyingjing liyingjing on 25 Oct 867 bytes 工程预评估
<template>
  <el-upload
    class="upload"
    :action="uploadConfig.url"
    :before-upload="beforeUpload"
    :on-success="onSuccess"
    :on-error="onError"
  >
    <slot></slot>
  </el-upload>
</template>

<script setup>
import { reactive } from 'vue'

const props = defineProps({
  uploadConfig: {
    type: Object,
    default: () => {}
  }
})

const emit = defineEmits(['success'])

const { uploadConfig } = props

const beforeUpload = (rawFile) => {
  console.log(rawFile)
  return true
}

const onSuccess = (response, uploadFile, uploadFiles) => {
  console.log(response, uploadFile, uploadFiles)
  emit('success')
}

const onError = (error, uploadFile, uploadFiles) => {
  console.log(error, uploadFile, uploadFiles)
}
</script>

<style lang="scss" scoped>
.upload {
  display: inline-block;
  ::v-deep(.el-upload-list) {
    display: none;
  }
}

</style>