Ad

VueJS Can't Render This Text

- 1 answer

I have this specific string in my db:

s"""{{{}}>>> ;d's

And as many other projects, my application root is the #app which wraps all my application.

When I try to display that string on screen

as this (blade template):

<div class="content">
    {{ $project->description }}
</div>

I got

invalid expression: Unexpected token ')' in

    "s&quot;&quot;&quot;"+_s({)+"&gt;&gt;&gt; ;d&#039;s"

  Raw expression: s&quot;&quot;&quot;{{{}}&gt;&gt;&gt; ;d&#039;s

error from Vue on console. I'm using a laravel application and blade templates. What should I do to show the string as is?

Ad

Answer

You can avoid the text being interpreted as Vue template syntax by using v-pre:

<div v-pre class="content">
    {{ $project->description }}
</div>

https://vuejs.org/v2/api/#v-pre

Ad
source: stackoverflow.com
Ad