上传组件提示调整

This commit is contained in:
a0049873 2022-12-13 14:32:03 +08:00
parent 05782a78be
commit 4605fce6b7
1 changed files with 10 additions and 6 deletions

View File

@ -2,7 +2,7 @@
* @Author: hisense.liangjunhua
* @Date: 2022-06-09 15:41:19
* @LastEditors: Light
* @LastEditTime: 2022-12-13 11:38:48
* @LastEditTime: 2022-12-13 14:31:13
* @Description: 上传组件
-->
<template>
@ -34,7 +34,7 @@
</a-upload>
</template>
<script setup>
import { ref, defineProps } from 'vue'
import { ref, defineProps, onBeforeUnmount } from 'vue'
// import { baseURL } from '@/config'
import { message, Upload } from 'ant-design-vue'
import mybus from '@/myplugins/mybus'
@ -48,6 +48,9 @@
emitFlag: { type: String, default: '' },
busType: { type: Number, default: 0 },
})
message.config({
top: `70px`,
})
console.log('window.SITE_CONFIG.apiURL', window.SITE_CONFIG.apiURL)
const apiURL = window.SITE_CONFIG.apiURL
const fileList = ref([])
@ -56,8 +59,7 @@
}
const beforeUpload = (file) => {
console.log(file)
// const isLt10M = file.size / 1024 / 1024 < 100
const isLt10M = file.size / 1024 / 1024 < 1
const isLt10M = file.size / 1024 / 1024 < 100
let flag
console.log(props.type)
if (props.type === '图片') {
@ -90,8 +92,7 @@
console.log(flag)
if (!flag) {
message.error(`${file.name} 不是${props.type}类型`)
}
if (!isLt10M) {
} else if (!isLt10M) {
message.error(`${file.name} 超出100M的大小`)
flag = false
}
@ -155,6 +156,9 @@
// eslint-disable-next-line vue/no-mutating-props
props.data.note1 = ''
}
onBeforeUnmount(() => {
message.destroy()
})
</script>
<style lang="less" scoped>
.upload-list-inline {