update 文件上传组件

This commit is contained in:
g7hoo 2022-09-29 10:31:25 +08:00
父節點 0b54133132
當前提交 d5af6a01f5
共有 3 個文件被更改,包括 9 次插入9 次删除

查看文件

@ -58,14 +58,14 @@ export default {
this.$watch('uploaderInjectFileList', function(val) {
if (val && val.length) {
console.log('this.uploaderInjectFileList', this.uploaderInjectFileList)
// console.log('this.uploaderInjectFileList', this.uploaderInjectFileList)
/** uploaderInjectFileList 里关于文件的信息比较全,需要手动过滤一下 */
this.fileList = val.map(item => {
const name = item.fileUrl.split('/').pop()
return { ...pick(item, ['id', 'fileName', 'typeCode']), name }
})
}
console.log('fillist: ', this.fileList)
// console.log('fillist: ', this.fileList)
})
// if (this.parentDataForm) {
@ -111,7 +111,7 @@ export default {
/** 图片验证,由配置文件开启 */
validateImage(file) {
console.log('[*] 验证图片')
// console.log('[*] ')
const isRightSize = file.size / 1024 / 1024 < 2
if (!isRightSize) {
@ -146,10 +146,10 @@ export default {
responseType: 'blob'
}).then(({ data: res }) => {
const blob = new Blob([res])
console.log('blob', blob)
// console.log('blob', blob)
if ('download' in document.createElement('a')) {
const alink = document.createElement('a')
console.log('filename: ', fileName)
// console.log('filename: ', fileName)
alink.download = fileName
alink.style.display = 'none'
alink.target = '_blank'

查看文件

@ -174,8 +174,8 @@ t.hints.date = 'Please select date'
t.hints.checktime = 'Please select inspection time'
t.hints.number = 'Please input correct number'
t.hints.addr = 'Please input address'
t.hints.upload2m = 'File size cannot be larger than 2mb (2048kb)'
t.hints.upload2mPic = 'Image files only. File size cannot be larger than 2mb (2048kb)'
t.hints.upload2m = 'File size cannot be larger than 2MB (2048KB)'
t.hints.upload2mPic = 'Image files only. File size cannot be larger than 2MB (2048KB)'
t.factory = {}
t.factory.title = 'Factory'

查看文件

@ -175,8 +175,8 @@ t.hints.date = '请选择日期'
t.hints.checktime = '请选择检测时间'
t.hints.number = '请输入正确的数值'
t.hints.addr = '请输入地址'
t.hints.upload2m = '上传文件大小不要超过 2mb (2048kb)'
t.hints.upload2mPic = '上传图片文件,且大小不要超过 2mb (2048kb)'
t.hints.upload2m = '上传文件大小不要超过 2MB (2048KB)'
t.hints.upload2mPic = '上传图片文件,且大小不要超过 2MB (2048KB)'
t.factory = {}
t.factory.title = '工厂'