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

161
Views
activar un método desde dentro de otra función

Tengo un método que envía datos a la base de datos y se puede activar desde un botón usando @click pero quiero activarlo desde otra función llamándolo en función condicional. ¿Alguien puede ayudar? la publicación está editada, así que quiero agregar el método addPatient llamado justo después de que se active la notificación enviada en else{}

 onSubmit () { namefRef.value.validate() namelRef.value.validate() birthdateRef.value.validate() if (namefRef.value.hasError || namelRef.value.hasError || birthdateRef.value.hasError ) { // form has error } else if (gender.value !== 'male'&& gender.value !== 'female') { $q.notify({ color: 'negative', message: 'You need to choose a gender' }) } else { $q.notify({ icon: 'done', color: 'positive', message: 'Submitted', }), loadinga.value = true setTimeout(() => {loadinga.value = false }, 300) } }, }

},

 data() { return{ patient:{ id:uid(), caption:'', namef:'', namel:'', age:'', lastappointment:'', location:'', photo:null, date:Date.now() }, loading:false, }

},

 methods:{ addPatient() { let formData = new FormData() formData.append('id', this.patient.id) formData.append('index', this.patient.index) formData.append('namef', this.namef) formData.append('namel', this.namel) formData.append('age', this.patient.age) formData.append('date', this.patient.date) formData.append('lastappointment', this.patient.lastappointment) //* formData.append('file', this.patient.photo, this.patient.id + '.png') this.$axios.post(`${ process.env.API}/createPatient`, formData).then( response => { console.log('response:',response) }).catch(err => { console.log('err:',err) }) }
about 4 years ago · Santiago Trujillo
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!