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

172
Views
EmailJS - Vue.js 2 and TS

I'm sorry, but I didn't find some similar issue on the web

Here is my problem, I tried to make a form to get contacted from an app.

I code with Vue.js 2 and TypeScript.

So here my code : My template :

      <form ref="form" class="form-data" @submit.prevent="sendEmail">
<input
          type="text"
          name="name"
          v-model="name"
          class="name"
          placeholder="your firstname + lastname"
        />
        <input
          type="email"
          name="email"
          v-model="email"
          class="email infos"
          placeholder="your email"
        />
<textarea
          class="message"
          name="message"
          v-model="message"
          placeholder=" your message">
        </textarea>
        <input class="btn" type="submit" @click.prevent value="Contact me" />
      </form>

My Script :

<script lang='ts'>
import {
  Component,
  Vue,
} from 'vue-property-decorator';
import emailjs from 'emailjs-com';

@Component({
  components: {},
})
export default class Contact extends Vue {
  private name = '';

  private email = '';

  private message = '';

  public sendMail() {
    emailjs.sendForm(
      'service_ID',
      'template_ID',
      this.$refs.form,
      'user_ID'
    )
   .then((result) => {
            console.log('SUCCESS!', result.text);
        }, (error) => {
            console.log('FAILED...', error.text);
        });
      this.name = '',
      this.email = '',
      this.message = '',
  }
</script>

I already try to create an object with my input value instead of this.$ref... but I have an error about arguments "expected 3-4 not 5".

Also, I have a parsing error with ESLint: "Expression expected".

I have Type error too:
"Argument of type 'Vue | Element | (Vue | Element)[] | undefined' is not assignable to parameter of type 'string | HTMLFormElement'. Type 'undefined' is not assignable to type 'string | HTMLFormElement'"

I hope someone can help me. Thank you !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to login to emailjs and you have to replace the service_ID, template_ID and user_ID parameters with your data in your EmailJs account.

about 4 years ago · Juan Pablo Isaza Report
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!