File-based routing — routes from file structure.
Structure:
pages/index.vue → /pages/about.vue → /aboutpages/posts/[id].vue → /posts/:id1<!-- pages/posts/[id].vue -->2<template>3 <div>4 <h1>Post {{ id }}</h1>5 </div>6</template>78<script setup>9const route = useRoute()10const id = route.params.id11</script>
Nested routes:
pages/posts/index.vue → /postspages/posts/[id].vue → /posts/:idDynamic routes:
[id] — dynamic segment.[...slug] — catch-all.