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
|
||||
class="btn ${btnUploading} ${sendFileClass}"
|
||||
onclick=${upload}
|
||||
onclick=${state.uploading ? noop : upload}
|
||||
title="${btnText}">
|
||||
${btnText}
|
||||
</button>
|
||||
|
@ -91,6 +91,8 @@ module.exports = function(state, emit) {
|
|||
</div>
|
||||
`;
|
||||
|
||||
function noop() {}
|
||||
|
||||
function dragover(event) {
|
||||
const div = document.querySelector('.uploadArea');
|
||||
div.classList.add('uploadArea--dragging');
|
||||
|
@ -117,20 +119,22 @@ module.exports = function(state, emit) {
|
|||
}
|
||||
}
|
||||
|
||||
async function addFiles(event) {
|
||||
function addFiles(event) {
|
||||
event.preventDefault();
|
||||
const newFiles = Array.from(event.target.files);
|
||||
|
||||
emit('addFiles', { files: newFiles });
|
||||
}
|
||||
|
||||
async function upload(event) {
|
||||
function upload(event) {
|
||||
event.preventDefault();
|
||||
|
||||
event.target.disabled = true;
|
||||
if (!state.uploading) {
|
||||
emit('upload', {
|
||||
type: 'click',
|
||||
dlimit: state.downloadCount || 1,
|
||||
password: state.password
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue