vue3 with prismic

named router views

you can have multiple router-views at the same time

catchAll route

{ path: '/:notFoundOrCatchAllOrAnyOtherText(.*)', redirect: '/' }

redirect route

routes: [
    { path: '/', redirect: '/teams'  },
    { path: '/teams', component: TeamsList },

or with alias (but url doesn't change)

routes: [
    { path: '/teams', component: TeamsList, alias:'/' },

watch the route updating

watch: {
    $route(newRoute) {
    teamId(newId) {
      console.log('teamId changed?',newId)


npm i --save vue-router

v-model on own component

add this to the component

  props: [ "modelValue"],
  emits: [ "update:modelValue" ],
  methods: {
    activateButton(opt) {
      this.$emit('update:modelValue', opt);


<your-component v-model="rating"></your-component>

TheHeader and other components prefixed with The

when you have a component that is only used once it is recommemended (see vue styleguide) to prefix it with 'The'

multiple elements in directly in template

in vue3 (not in vue2) you don't need a root element in a template. you can use a <h2> and a <p> directly in the <template> without wrapping them with a <div> or something. this is a feature called fragments.


wrap a custom dialog with <teleport to='body'> to teleport for the dialog from a component to the body.

dynamic components with keep-alive

when using keep-alive vue keeps data and won't destroy it when changing component:is

  <component :is="selectedComponent">hoi</component>

slot props

slot props pass data from a component to the parent of the component. this way you can have a v-for in a component and have the parent use the data and pass in custom styling/data.

the component:

    <li v-for="goal in goals" :key="goal">
      <slot :myItem="goal" another-prop="..."></slot>

the parent:

  <template #default="slotProps">


<template v-slot:header> can be replaced with <template #header></template>

"export 'App' was not found in './App.vue'

make sure you don't have { } around App at import. It should be like this:

import App from "./App.vue";


npm install -g @vue/cli
npm install -g @vue/cli-init
vue init webpack-simple quickstart
cd quickstart
npm install