Skip to content

Commit

Permalink
pdate numMax preCheck and multi-fired drag events issue
Browse files Browse the repository at this point in the history
misc: update numMax preCheck and multi-fired drag events issue
  • Loading branch information
ZianeCui authored Aug 29, 2017
2 parents b55b95a + 2dd4751 commit 1df68eb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 10 additions & 6 deletions src/js/components/form/KLUpload/components/UploadBase/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const UploadBase = Component.extend({
_.extend(data, {
fileUnitList: [],
dragover: false,
dragenterCount: 0,
});

this.initWatchers();
Expand Down Expand Up @@ -232,27 +233,30 @@ const UploadBase = Component.extend({
},

onDragEnter(e) {
const data = this.data;
e.stopPropagation();
e.preventDefault();
data.dragover = true;
data.dragenterCount += 1;
},

onDragOver(e) {
this.data.dragover = true;
console.log(`over ${this.data.dragover}`);
e.stopPropagation();
e.preventDefault();
},

onDragLeave(e) {
this.data.dragover = false;
console.log(`leave ${this.data.dragover}`);
const data = this.data;
e.stopPropagation();
e.preventDefault();
data.dragenterCount -= 1;
if (data.dragenterCount === 0) {
data.dragover = false;
}
},

onDrop(e) {
this.data.dragover = false;
console.log(`drop ${this.data.dragover}`);
e.stopPropagation();
e.preventDefault();

Expand All @@ -279,7 +283,7 @@ const UploadBase = Component.extend({
checker.then((preCheckInfo) => {
data.preCheckInfo = preCheckInfo;
self.$update();
if (!data.preCheckInfo) {
if (!data.preCheckInfo && data.fileUnitList.length < data.numMax) {
const fileunit = {
rawFile: file,
name: file.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,9 @@ $margin = 20;
font-size: 12px;
cursor: pointer;
.u-input-content {
position: relative;
display: inline-block;
width: 100%;
vertical-align: middle;
z-index: -1;
.u-icon {
display: inline-block;
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ $margin = 25;
font-size: 12px;
cursor: pointer;
.u-input-content {
position: relative;
display: inline-block;
width: 100%;
vertical-align: middle;
z-index: -1;
.u-icon {
display: inline-block;
width: 100%;
Expand Down

0 comments on commit 1df68eb

Please sign in to comment.