Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
La carga de entrada de Vue no funciona después de cancelar

Así que tengo este elemento v-btn en mi proyecto vue que uso para cargar un archivo. El nombre del archivo cargado se guarda en una cadena pickeruploadedref . Agregué un elemento div con v-if=pickeruploadref!='' que muestra el nombre del archivo cargado guardado en pickeruploadedref y un botón que al hacer clic ejecuta el método canceluploadref que simplemente vuelve a pickeruploadedref en una cadena vacía. Este es mi código en la plantilla

 <!-- 1. Create the button that will be clicked to select a file --> <v-btn color="primary" rounded dark :loading="isSelectingref" @click="handleFileImportref" > Upload File </v-btn> <!-- Create a File Input that will be hidden but triggered with JavaScript --> <input ref="uploader1" class="d-none" type="file" @change="onFileChangedref" > <div v-if="pickeruploadref!=''"> {{this.pickeruploadref}} <v-btn class="ma-2" outlined small fab color="red" @click="canceluploadref()" > <v-icon>mdi-close</v-icon> </v-btn> </div>

en guión

 export default { data() { return { isSelectingref: false, pickerref: "", pickeruploadref:"", } }, methods: { canceluploadref(){ console.log(this.pickeruploadref) this.pickeruploadref='' console.log(this.pickeruploadref) }, handleFileImportref() { this.isSelectingref = true; // After obtaining the focus when closing the FilePicker, return the button state to normal window.addEventListener('focus', () => { this.isSelectingref = false }, { once: true }); // Trigger click on the FileInput this.$refs.uploader1.click(); }, onFileChangedref(e) { if (e.target.files[0]!=null) { let name= e.target.files[0].name; name=name.replace('.json','') this.pickeruploadref=name console.log(this.pickeruploadref) }

la primera vez que uso el botón, todo funciona bien, el nombre del archivo se guarda en la cadena pickeruploadedref y el botón para hacer pickeruploadedref se muestra una cadena vacía y cuando hago clic en él, pickeruploadedref está vacío nuevamente, pero cuando reutilizo el botón de carga, pickeruploadedref permanece como una cadena vacía y handlefileimportref no se ejecuta por algún motivo.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!