Installation

基本用法

最简单的用法

<script setup lang="ts">
  import { Switch } from '@lite-space/ui'

  const checked = ref(true)
</script>

<template>
  <Switch v-model="checked" />
</template>
不可用

Switch 禁用状态

<script setup lang="ts">
  import { Switch } from '@lite-space/ui'

  const checked = ref(true)
</script>

<template>
  <Switch v-model="checked" disabled />
</template>
文字和图标

带有文字和图标

<script setup lang="ts">
  import { Switch } from '@lite-space/ui'

  const value1 = ref(true)
  const value2 = ref(true)
</script>

<template>
  <Switch v-model="value1" checked-children="i-carbon:accessibility" un-checked-children="i-carbon:accessibility-alt" />
  <Switch v-model="value2" checked-children="" un-checked-children="" />
  <Switch>
    <template #checkedChildren>
      <span></span>
    </template>
    <template #unCheckedChildren>
      <span></span>
    </template>
  </Switch>
</template>