소스 검색

update 文件上传组件

pull/7/head
g7hoo 2 년 전
부모
커밋
d5af6a01f5
3개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. +5
    -5
      src/components/base-upload/index.vue
  2. +2
    -2
      src/i18n/en.js
  3. +2
    -2
      src/i18n/zh-CN.js

+ 5
- 5
src/components/base-upload/index.vue 파일 보기

@@ -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'


+ 2
- 2
src/i18n/en.js 파일 보기

@@ -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'


+ 2
- 2
src/i18n/zh-CN.js 파일 보기

@@ -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 = '工厂'


불러오는 중...
취소
저장