Eric Evans
Eric Evans

Reputation: 670

Create a newline from computed string

I would like to know how to add a newline in a computed string with the concatenation of string values. I need the values to be this.

1111 Ave, Apt 107
Iowa mycity, myzip

Here's what I have.

companyAddress()
            {
                return this.lead.address + ", " + this.lead.address2 + '\n' +
                    this.lead.state + ", " +  this.lead.city + " " + this.lead.zip;
            } 

I get values no problem, but I can't get the \n to separate to two lines.

Upvotes: 1

Views: 365

Answers (1)

power-cut
power-cut

Reputation: 1498

You can use v-html in your template.

<span v-html="companyAddress"></span>


companyAddress() {
   return `${this.lead.address, ${this.lead.address2} <br> ${this.lead.state}, ${this.lead.city} ${this.lead.zip}`;
}

Upvotes: 1

Related Questions