0
0
Vueframework~10 mins

Raw HTML with v-html in Vue - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to bind raw HTML content inside a Vue template using v-html.

Vue
<template>
  <div [1]="rawHtmlContent"></div>
</template>
Drag options to blanks, or click blank then click option'
Av-html
Bv-text
Cv-bind
Dv-show
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-text instead of v-html causes HTML tags to show as text.
Using v-show or v-bind does not insert raw HTML.
2fill in blank
medium

Complete the code to define a reactive raw HTML string in the Vue setup script.

Vue
<script setup>
import { ref } from 'vue'
const rawHtmlContent = [1]('<strong>Hello!</strong>')
</script>
Drag options to blanks, or click blank then click option'
Areactive
Bcomputed
Cref
Dwatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using reactive instead of ref causes errors with primitive strings.
Using computed or watch is not for defining reactive values directly.
3fill in blank
hard

Fix the error in the template by completing the directive to correctly render raw HTML.

Vue
<template>
  <p [1]="rawHtmlContent"></p>
</template>
Drag options to blanks, or click blank then click option'
Av-html
Bv-if
Cv-text
Dv-on
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-text instead of v-html.
Using v-if or v-on which do not insert HTML content.
4fill in blank
hard

Fill both blanks to create a reactive raw HTML string and bind it in the template.

Vue
<template>
  <div [1]="htmlContent"></div>
</template>

<script setup>
import { [2] } from 'vue'
const htmlContent = [2]('<em>Vue is fun!</em>')
</script>
Drag options to blanks, or click blank then click option'
Av-html
Bref
Cv-text
Dreactive
Attempts:
3 left
💡 Hint
Common Mistakes
Using v-text instead of v-html in the template.
Using reactive instead of ref for the string.
5fill in blank
hard

Fill all three blanks to create a reactive raw HTML string, import the correct function, and bind it in the template.

Vue
<template>
  <section [1]="contentHtml"></section>
</template>

<script setup>
import { [2] } from 'vue'
const contentHtml = [2]('[3]')
</script>
Drag options to blanks, or click blank then click option'
Av-html
Bref
C<strong>Welcome!</strong>
Dreactive
Attempts:
3 left
💡 Hint
Common Mistakes
Using reactive instead of ref for the string.
Using v-text instead of v-html in the template.
Not providing a valid HTML string.