disable upload button while uploading. fixes #927
This commit is contained in:
parent
3d2c8c2ce2
commit
17a0393ce0
1 changed files with 13 additions and 9 deletions
|
@ -78,7 +78,7 @@ module.exports = function(state, emit) {
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="btn ${btnUploading} ${sendFileClass}"
|
class="btn ${btnUploading} ${sendFileClass}"
|
||||||
onclick=${upload}
|
onclick=${state.uploading ? noop : upload}
|
||||||
title="${btnText}">
|
title="${btnText}">
|
||||||
${btnText}
|
${btnText}
|
||||||
</button>
|
</button>
|
||||||
|
@ -91,6 +91,8 @@ module.exports = function(state, emit) {
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
function noop() {}
|
||||||
|
|
||||||
function dragover(event) {
|
function dragover(event) {
|
||||||
const div = document.querySelector('.uploadArea');
|
const div = document.querySelector('.uploadArea');
|
||||||
div.classList.add('uploadArea--dragging');
|
div.classList.add('uploadArea--dragging');
|
||||||
|
@ -117,20 +119,22 @@ module.exports = function(state, emit) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addFiles(event) {
|
function addFiles(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const newFiles = Array.from(event.target.files);
|
const newFiles = Array.from(event.target.files);
|
||||||
|
|
||||||
emit('addFiles', { files: newFiles });
|
emit('addFiles', { files: newFiles });
|
||||||
}
|
}
|
||||||
|
|
||||||
async function upload(event) {
|
function upload(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
event.target.disabled = true;
|
||||||
emit('upload', {
|
if (!state.uploading) {
|
||||||
type: 'click',
|
emit('upload', {
|
||||||
dlimit: state.downloadCount || 1,
|
type: 'click',
|
||||||
password: state.password
|
dlimit: state.downloadCount || 1,
|
||||||
});
|
password: state.password
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue