π Pattern Matching Switch Match Component for Vue and Nuxt. Inspired by Solid.js
Refer to the Vue or Nuxt README for installation instructions.
<script lang="ts" setup>
const state = ref(0)
const swap = () => {
const newValue = state.value === 0 ? 1 : 0
state.value = newValue
}
</script>
<template>
<button @click="swap">Click Me !</button>
<button @click="(state = 2)">Fallback</button>
<Switch>
<Match :when="state === 0">Hello</Match>
<Match :when="state === 1">World</Match>
<Fallback>Bye</Fallback>
</Switch>
</template>
Contributions, issues and feature requests are welcome!
Fork this repo
Intall pnpm corepack enable && pnpm corepack use pnpm@latest
Use pnpm i at the mono-repo root.
Make modifications and follow conventional commits.
Open a PR πππ
We use cookies
We use cookies to analyze traffic and improve your experience. You can accept or reject analytics cookies.