update Upload
update Upload
This commit is contained in:
parent
bc3bcb098b
commit
a6ac0a7603
3 changed files with 133 additions and 64 deletions
|
@ -202,6 +202,24 @@
|
|||
}
|
||||
},
|
||||
post (file) {
|
||||
// check format
|
||||
if (this.format.length) {
|
||||
const _file_format = file.name.split('.').pop().toLocaleLowerCase();
|
||||
const checked = this.format.some(item => item.toLocaleLowerCase() === _file_format);
|
||||
if (!checked) {
|
||||
this.onFormatError(file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// check maxSize
|
||||
if (this.maxSize) {
|
||||
if (file.size > this.maxSize * 1024) {
|
||||
this.onExceededSize(file);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this.handleStart(file);
|
||||
let formData = new FormData();
|
||||
formData.append(this.name, file);
|
||||
|
@ -235,24 +253,6 @@
|
|||
showProgress: true
|
||||
};
|
||||
|
||||
// check format
|
||||
if (this.format.length) {
|
||||
const _file_format = _file.name.split('.').pop().toLocaleLowerCase();
|
||||
const checked = this.format.some(item => item.toLocaleLowerCase() === _file_format);
|
||||
if (checked) {
|
||||
this.onFormatError(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// check maxSize
|
||||
if (this.maxSize) {
|
||||
if (_file.size > this.maxSize * 1024) {
|
||||
this.onExceededSize(file);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.fileList.push(_file);
|
||||
},
|
||||
getFile (file) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
& + span{
|
||||
& > span{
|
||||
cursor: pointer;
|
||||
transition: color @transition-time @ease-in-out;
|
||||
i{
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
&:hover{
|
||||
background: @input-disabled-bg;
|
||||
& + span{
|
||||
& > span{
|
||||
color: @primary-color;
|
||||
i{
|
||||
color: @text-color;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue