user15848731
user15848731

Reputation: 21

Is it possible to pass a styled value of a variable in Vue

EDIT: Without using v-html as we have an eslint no-v-html

Is it possible to show something like "The community is here to help you with specific strong text coding, algorithm, or language problems " using data in vue?

Code is something like this:

<template>
 {{ description }}
</template>

<script>
export default {
 data() {
    return {
     description: 'The community is here to help you with specific strong text <strong> coding, algorithm, or language problems </strong>
 }
}

</script>

Upvotes: 0

Views: 49

Answers (2)

eldo
eldo

Reputation: 1326

<template>
  <div id="description"></div>
</template>

<script>

export default {
  mounted() {
    document.getElementById('description').innerHTML = 'The community is here to help you with specific strong text <strong> coding, algorithm, or language problems </strong>'
  }
};
</script>

Upvotes: 0

Yeap, just use

<div v-html="description"></div>

Upvotes: 2

Related Questions