Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Template Syntax and Rendering Data | Section
Üben
Projekte
Quiz & Herausforderungen
Quizze
Herausforderungen
/
Vue.js Fundamentals and App Development

bookTemplate Syntax and Rendering Data

Swipe um das Menü anzuzeigen

Vue allows you to display data in the interface using template syntax. Instead of manually updating the page with JavaScript, you bind data directly in the template.

Inside a Vue component, you define data in the <script> section and use it in the <template>.

<script setup>
import { ref } from "vue";

const message = ref("Hello Vue");
</script>

<template>
  <h1>{{ message }}</h1>
</template>

The {{ }} syntax is called interpolation. It displays the value of a variable inside the template.

Vue automatically keeps the UI in sync with the data. When the value changes, the interface updates.

<script setup>
import { ref } from "vue";

const message = ref("Hello Vue");

message.value = "Updated Message";
</script>

After the value changes, the text on the page updates automatically.

You can also use expressions inside the template.

<p>{{ message + "!" }}</p>

Template syntax allows you to connect data with the interface in a simple and declarative way.

question mark

What does {{ message }} do in a Vue template?

Wählen Sie die richtige Antwort aus

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 4

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Abschnitt 1. Kapitel 4
some-alt