上传组件提示调整

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