Skip to content
Advertisement

Use HTML entities in my block in Vue.js

I want to use the HTML-Symbols &#9650 and &#9660 that stand for “arrow up” and “arrow down” in the <script> section of my Vue.js component. I know that something simple as the following doesn’t work. But I tried different functions that I found on the internet and nothing worked.

JavaScript

Advertisement

Answer

There are two ways to achieve this :

  1. Use v-html directive

JavaScript
JavaScript
  1. Use innerHTML instead of textContent

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement