0

I need to create a method that returns the email formatted to insert as the href value of an anchor tag. So the method needs to return the formatted string the the format: " maillto:[email protected]".

var facultyInformation = new Vue({
     el: "#facultyInformation",
     data: {
          name:{
               first: "first name here",
               last: "last name here"
               },
               email: "the email here"
          }
     },
     methods: {
          getFormattedEmail: function(){
               return this.email;
          }
     }
}
1
  • 1
    I would personally caution about using mailto: links now days (and have for a few years now). It is supremely easy for web crawlers to crawl websites, grab email links like those, and throw them into email lists for later spam usages and to sell to others who will spam you. Commented Nov 13, 2020 at 23:46

1 Answer 1

1

I think you want this:

getFormattedEmail: function () {
  return `mailto:${this.email}` // same as "mailto:" + this.email
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.