🚀 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 iat the mono-repo root. -
Make modifications and follow conventional commits.
-
Open a PR 🚀🚀🚀