Replace with VueJS

1

Next, I'm doing a Filter to fetch some words passed by parameters and check if it exists in the text. Any words that are the same I have to highlight them with a bold and a background. However, when I put the strong tag, vuejs would not render properly.

I have something similar to this:

<p>{{texto|detarcarPalavra("palavra")}}<p>

In the output I wanted that, if the word is found, give a prominence only in this word.

    
asked by anonymous 14.11.2017 / 13:43

1 answer

1

In this case it would be best to use v-html . This tool can open security holes in the application, so it should be used with care.

But for this purpose you can do this:

<p v-html="detarcarPalavra(texto, "palavra")"><p>
    
14.11.2017 / 14:07