A `<VSwitch>` component for Vue.js 3.
npm install @lmiller1990/v-switchA component for Vue.js 3.
``sh
yarn add @lmiller1990/v-switch
npm install @lmiller1990/v-switch
`
is modeled after the switch statement we all know and love.
`vue
Big
Small
Default
`
It also works with dynamic slots:
`vue
v-for="num in numbers"
v-slot:[num]
>
Number: {{ num }}
Default
`
If you are using the browser build, or you like to register components globally, that works fine, too:
`js
// with a bundler
import { createApp } from 'vue'
const app = createApp(/ ... /)
app.component('v-switch', VSwitch)
// or using the global build
// assumes Vue is available globally - VSwitch is available globally via VSwitch`
const app = Vue.createApp(/ ... /)
app.component('v-switch', VSwitch)
There are three builds available.
- dist/v-switch.cjs,js: for SSR in node.js (using require)dist/v-switch.esm-bundler.js
- : for bundlers like Webpack and Rollup
- also works as an ES module in the browser using