Skip to content
Snippets Groups Projects
Commit 9a6c1541 authored by Otto Zaiser's avatar Otto Zaiser
Browse files

Seleccionar otro archivo function

parent c4f2b388
No related branches found
No related tags found
No related merge requests found
source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
...@@ -21,12 +21,12 @@ ...@@ -21,12 +21,12 @@
</svg> </svg>
<!-- <img class="center-v" src="static/images/loader.svg" width="100px" height="100px" alt="Cargando"> --> <!-- <img class="center-v" src="static/images/loader.svg" width="100px" height="100px" alt="Cargando"> -->
</div> </div>
<input type="file" id="fileUpload" @change="handleInput" hidden>
<div> <div>
<div v-if="uploadedFiles.length == 0"> <div v-if="uploadedFiles.length == 0">
<div><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div> <div><span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span></div>
<div class="droptxt">Arrastrá un archivo aquí<br>ó</div> <div class="droptxt">Arrastrá un archivo aquí<br>ó</div>
<div><button type="button" class="btn btn-primary btn-pill" v-on:click.stop="uploadFile()">Seleccioná un archivo <span class="sr-only">para Sellar o Verificar</span></button></div> <div><button type="button" class="btn btn-primary btn-pill" v-on:click.stop="uploadFile()">Seleccioná un archivo <span class="sr-only">para Sellar o Verificar</span></button></div>
<input type="file" id="fileUpload" @change="handleInput" hidden>
</div> </div>
<div v-if="uploadedFiles.length > 0" class="file-info"> <div v-if="uploadedFiles.length > 0" class="file-info">
<p> <p>
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<button class="btn btn-lg btn-success btn-pill" v-if="uploadedFiles.length > 0" v-on:click="verify(uploadedFiles[0].hash)">Verificar</button> <button class="btn btn-lg btn-success btn-pill" v-if="uploadedFiles.length > 0" v-on:click="verify(uploadedFiles[0].hash)">Verificar</button>
</div> </div>
<div class="gobackLink font_small" v-if="uploadedFiles.length > 0" > <div class="gobackLink font_small" v-if="uploadedFiles.length > 0" >
<a href="#" v-on:click.stop="goBack()">Seleccionar otro archivo</a> <a href="#" v-on:click.stop.prevent="goBack">Seleccionar otro archivo</a>
</div> </div>
</div> </div>
</template> </template>
...@@ -76,8 +76,10 @@ export default { ...@@ -76,8 +76,10 @@ export default {
if (this.uploadedFiles.length <= 0) this.uploadFile(); if (this.uploadedFiles.length <= 0) this.uploadFile();
}, },
handleInput(e) { handleInput(e) {
var files = e.target.files if(e.target.files.length > 0){
this.uploadFiles([files[0]]) var files = e.target.files
this.uploadFiles([files[0]])
}
}, },
handleDrop(e) { handleDrop(e) {
var files = e.dataTransfer.files; var files = e.dataTransfer.files;
...@@ -87,6 +89,7 @@ export default { ...@@ -87,6 +89,7 @@ export default {
}, },
goBack(){ goBack(){
this.uploadedFiles = []; this.uploadedFiles = [];
document.getElementById("fileUpload").click()
}, },
verify(h) { verify(h) {
var self = this; var self = this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment