Let's break it down simply
In a template, {{ value }} is text interpolation. To bind an HTML attribute to a reactive value, use v-bind or its shorthand :. Never render user input directly with v-html.
vue
<script setup>
const profile = {
name: 'Su Su',
avatar: '/avatar.png',
active: true
}
</script>
<template>
<h2>{{ profile.name }}</h2>
<img :src="profile.avatar" :alt="profile.name">
<p :class="{ online: profile.active }">Online</p>
</template>You should see
Su Su
[avatar image]
OnlineTry it yourself
Create a product object and display its title, price, and image src in the template.
Template Syntax — Vue.js