'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.



Solution 1:[1]

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}`;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 power-cut