Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Creating and Using Components | Section
Harjoittele
Projektit
Tietovisat & Haasteet
Visat
Haasteet
/
Vue.js Fundamentals and App Development

bookCreating and Using Components

Pyyhkäise näyttääksesi valikon

In Vue, components are created as separate .vue files and then used inside other components.

Create a new component file inside the components folder.

<!-- Message.vue -->
<template>
  <p>Hello from component</p>
</template>

To use this component, import it and add it to your template.

<script setup>
import Message from "./components/Message.vue";
</script>

<template>
  <Message />
</template>

The imported component works like a custom HTML element.

You can create multiple components and combine them to build the full interface.

This approach helps organize your application into smaller, reusable parts.

question mark

Which step is required to use a custom component like Greeting in your App.vue file?

Valitse oikea vastaus

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 10

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Osio 1. Luku 10
some-alt