Vue 3 · Setup

Component skeleton

A single-file component with script setup, a template and scoped styles.

<script setup lang="ts">
import { ref } from "vue";
const count = ref(0);
</script>

<template>
  <button @click="count++">Clicked {{ count }} times</button>
</template>

<style scoped>
button { font-weight: bold; }
</style>

Official Vue 3 documentation

More setup commands

All setup commands · Vue 3 cheatsheet

Was this page helpful?